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

Solved How to add affects to a player?

Discussion in 'Development' started by SkyZone, Apr 12, 2017.

  1. SkyZone

    SkyZone Slime

    Messages:
    95
    I tried that, like i found it in the old forums:
    PHP:
    $player->addEffect(Effect::JUMP);
    But its not working.
    What did I do wrong?
     
  2. Jonas

    Jonas Baby Zombie

    Messages:
    192
    Try this:
    PHP:
    $effect Effect::getEffect(Effect::JUMP);
            
    $effect->setAmplifier(4);
            
    $effect->setDuration(23333);
            
    $player->addEffect($effect);
     
    SkyZone likes this.
  3. SkyZone

    SkyZone Slime

    Messages:
    95
    Works, thanks :D
     
  4. Jonas

    Jonas Baby Zombie

    Messages:
    192
    You 're welcome
     
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    The reason your code didn't work is because the parameter for the function requires an instance of the Effect class rather than an integer.
     
  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.