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

Particles

Discussion in 'Development' started by LucGamesDE, May 21, 2017.

  1. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Is there a way to spawn particles only for some players or something like that?
     
  2. Michael

    Michael Baby Zombie

    Messages:
    113
    GitHub:
    michaelm04
    Yes,
    \pocketmine\level addParticle(Particle $particle, array $players).

    When calling the function, build an array with only the players you want to send the particle to. For example, if you want to only send particles to players with a certain permission try this:
    PHP:
    $players = array();
    /** $player instanceof Player */
    if($player->hasPermission("example.permission")){
        
    array_push($players$player);
    }

    /** Assuming $particle is set */
    $player->getLevel()->addParticle($particle$players);
     
    jasonwynn10 and LucGamesDE like 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.