Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add effect when player use a Warp

Comments in 'Plugin Development' started by TonyDroidd, Apr 16, 2015.

  1. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    How i can add effect when the player use a warp??

    With This:
    PHP:
        public function warpAs(CommandSender $senderPlayer $p){
            if(
    $this->canUse($sender)){
                
    $p->teleport($this->p);
                
    $p->sendMessage("§4§l>");
                
    $p->sendMessage("§4§l> §aHaz sido teletransportado a §3" $this->name);
                
    $p->sendMessage("§4§l>");
                
    $p->sendPopup("§l§bBienvenido a §l§c" $this->name);
  2. TheLucyClub
    Offline

    TheLucyClub Banned

    Joined:
    Jan 31, 2015
    Posts:
    53
    Minecraft User:
    iCreepyKid
    what does
    PHP:
    $p->sendPopup("Popup!");
    do?
  3. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
  4. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    Any help? :/
  5. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Write use pocketmine\entity\Effect;
    And code:
    PHP:
    public function warpAs(CommandSender $senderPlayer $p){
    if(
    $this->canUse($sender)){$p->teleport($this->p);
            
    $effect Effect::getEffect(1); //Effect ID
            
    $effect->setVisible(true); //Effect particles
            
    $effect->setDuration(300); //Duration in ticks
            
    $p->addEffect($effect);
            
    $p->sendMessage("§4§l>");
            
    $p->sendMessage("§4§l> §aHaz sido teletransportado a §3" $this->name);
            
    $p->sendMessage("§4§l>");
            
    $p->sendPopup("§l§bBienvenido a §l§c" $this->name);
  6. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    Not Work :(
  7. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    I make plugin with this code and it work greatly!
    Server make CrashDump?
  8. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Omg... I wrote it? I wrote
    PHP:
    pocketmine\entity\Effect;
    TonyDroidd likes this.
  9. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    oh, really i forgot that xD
    thank you
  10. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Lol, try it, it should works.
    TonyDroidd likes this.
  11. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    it work in my Plugin Test Server, but no in my big server :c
  12. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Its bad :C
    What errors?
  13. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    dont give me any error log, only the effects do no appear
  14. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Hmmm...
  15. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    :(
    In my windows server (for plugin test): it works :D
    In my linux server (PVP and Minigames): it not work :(
  16. PlayCubePE
    Offline

    PlayCubePE New Member

    Joined:
    Mar 19, 2015
    Posts:
    29
    Minecraft User:
    PlayCubePE
    Maybe, than in your linux servers somethings like plugins can disturb the addEffect() ...
    Is there a plugin that uses pocketmine\entity\Effect ?
    TonyDroidd likes this.
  17. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    Mmm... Maybe, and Yes, uses the class pocketmine\entity\Effect
  18. PlayCubePE
    Offline

    PlayCubePE New Member

    Joined:
    Mar 19, 2015
    Posts:
    29
    Minecraft User:
    PlayCubePE
    Are you sure that in your Linux server, in the code for the command is there :
    PHP:
    public function warpAs (Command Sender $senderPlayer $p) {
    // Effect codes
    }
    Because, if there's not Player $p it won't work! If use it on :

    PHP:
    if($this->canUse($sender)){$p->teleport($this->p);
            
    $effect Effect::getEffect(1); //Effect ID
            
    $effect->setVisible(true); //Effect particles
            
    $effect->setDuration(300); //Duration in ticks
            
    $p->addEffect($effect);
            
    $p->sendMessage("§4§l>");
            
    $p->sendMessage("§4§l> §aHaz sido teletransportado a §3" $this->name);
            
    $p->sendMessage("§4§l>");
            
    $p->sendPopup("§l§bBienvenido a §l§c" $this->name)
    Like, if it works!
    TonyDroidd likes this.
  19. TonyDroidd
    Offline

    TonyDroidd Active Member

    Joined:
    Sep 6, 2014
    Posts:
    180
    Minecraft User:
    TonyDroidd
    like, thank you :D
  20. PlayCubePE
    Offline

    PlayCubePE New Member

    Joined:
    Mar 19, 2015
    Posts:
    29
    Minecraft User:
    PlayCubePE
    Thanks you, but here i don't understand, did it works ?

Share This Page

Advertisement