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

Giving player Effect with amplifier and duration

Discussion in 'Development' started by rektpixel, Aug 20, 2017.

  1. rektpixel

    rektpixel Baby Zombie

    Messages:
    186
    hey how do I give $killer effect 10 for 2 seconds with amplifier 50
    I did this but I know its wrong XD
    PHP:
    $killer->addEffect(10)->setAmplifier(50)->setDuration(2);
     
  2. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
     
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    artulloss, jasonwynn10 and rektpixel like this.
  4. RumDaDuMCPE

    RumDaDuMCPE Witch

    Messages:
    67
    GitHub:
    RumDaDuMCPE
    PHP:
    $time 2;
    $ticks 20 $time;
    $visibility false// Set to true if you need the particles to be visible.
    $amplifier 50// Effect Amplifier.
    $id 10// Effect ID.
    $effect Effect::getEffect($id)->setAmplifier($amplifier)->setDuration($ticks)->setVisible($visibility);

    $killer->addEffect($effect);
    Or, ya know, you can take the easy road and go like
    PHP:
    $killer->addEffect(Effect::getEffect(10)->setAmplifier(50)->setDuration(20*2)->setVisible(false));
     
    Last edited: Aug 23, 2017
  5. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    Wrong placement of parentheses, it should be:
    PHP:
    $killer->addEffect(Effect::getEffect(10)->setAmplifier(50)->setDuration(20*2)->setVisible(false));
    :p
     
  6. RumDaDuMCPE

    RumDaDuMCPE Witch

    Messages:
    67
    GitHub:
    RumDaDuMCPE
    Aye thanks <3
    I edited it :)
     
    Sandertv likes this.
  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.