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

Solved Removing Effects

Discussion in 'Development' started by Teamblocket, Apr 11, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    hey , how can i remove an effect? I've try
    PHP:
    $player->removeEffect($speed);
    but it doesn't work :(
     
  2. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    Hi TB , that should work if $speed is set to the correct effect ID... but I think the best way is to get the effect ID directly from the Effect class:

    PHP:
    use pocketmine\entity\Effect;
    ...
    $player->removeEffect(Effect::SPEED);
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    am pretty sure i tried that to but ill give it another test
     
  4. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Thanks , i was doing Effect::getEffect(1); silly me , now it works
     
  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.