1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Ding sound

Discussion in 'Help' started by MalakasPlayzMCPE, Sep 19, 2018.

  1. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
  2. SleepSpace9

    SleepSpace9 Slime

    Messages:
    78
    GitHub:
    sleepspace9
    You could simply use AnvilFallSound for playing <ding> (including custom pitch).
     
    OnTheVerge and Eduardo like this.
  3. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    SOUND_SHOOT did nothing by the way. Could anybody tell me which pitch is the best one, or get me a website to test the pitches? If it is a website, could you give me the anvilfallsound sound file?
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    test it out yourself we cant just spoof feed you
    hint, use a delayed task to iterate through all sounds
     
  5. MalakasPlayzMCPE

    MalakasPlayzMCPE Zombie Pigman

    Messages:
    667
    I did something else. A command, like /test <pitch>

    But the result is not what I expected. All the time I get the same thing.

    PHP:
    <?php

    namespace TestThing;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\level\sound\GenericSound;
    use 
    pocketmine\math\Vector3;

    class 
    Test extends PluginBase{
        
        public function 
    onEnable(){
            
    $this->getLogger()->info("Enabled!");
        }
        
        public function 
    onCommand(CommandSender $senderCommand $cmdstring $label, array $args): bool{
            if(
    $cmd->getName() === "test"){
                
    $sender->getLevel()->addSound(new AnvilFallSound($sender->asVector3(), intval($args[0])), [$sender]);
                
    $sender->sendMessage(TextFormat::GREEN."Is this one good?");
                return 
    true;
            }
        }
    }


    class 
    AnvilFallSound extends GenericSound{

        public function 
    __construct(Vector3 $posfloat $pitch 0){
            
    parent::__construct($pos1022$pitch);
        }
    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.