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

How can I add a effect to a command?

Discussion in 'Plugin Help' started by RoccoYT, Oct 28, 2019.

  1. RoccoYT

    RoccoYT Spider

    Messages:
    14
    GitHub:
    RoccoTheDev
    What's here the mistake or what is another option to add an effect to an player for 600 seconds with amplification 4?
     

    Attached Files:

  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    PHP:
    $effect Effect::getEffect(3);
    $duration 600 20// times 20 because it's in ticks
    $amplification 4;
    $effectInstance = new EffectInstance($effect$duration$amplification);
    $player->addEffect($effectInstance);
     
  3. AsponPL

    AsponPL Spider Jockey

    Messages:
    47
    u need to use :

    PHP:
    use pocketmine\entity\Effect;
    use 
    pocketmine\entity\EffectInstance;
    and this code :

    PHP:
    $player->addEffect((new EffectInstance(Effect::getEffect(Effect::REGENERATION)))->setDuration(intval(20*600))->setAmplifier(intval(4)));
     
  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.