How I can show a different popup to each player in the server? Let's say I've got two arrays with different players... How to show a different popup to the people inside the first array?
PHP: /** @var pocketmine\Player[] $array1 */$array1 = [];/** @var pocketmine\Player[] $array2 */$array2 = [];foreach($array1 as $arr1) { $arr1->sendPopup("Your popup");}foreach($array2 as $arr2) { $arr2->sendPopup("Your popup #2");}
Are you talking about FloatingTextParticle? When you call Level::addParticle(), add a second parameter with an array of all the players that are supposed to see it.
<?= str_replace("this helpful topic", "https://forums.pocketmine.net/threads/remove-particle.11325/", str_replace("<User>", "@AndrewBit", <<<EOM "<User> maybe you should use the Wiki etc", "Try googling this helpful topic", "Here's the completed code maybe you can learn from it " EOM )) ?>
Well, I mean how to hide it for a specific player. By the way, what's the point of use str_replace instead tell me it directly?
You need to send the specific players a RemoveEntityPacket which is going to require you to know the entity ID of the FloatingTextParticle (it's not really a particle, it's actually just an invisible mob). Since the $entityId aspect of FloatingTextParticle is protected, you're not going to be able to easily get (or even set) the entity ID. So you have 2 options: * Spawn the entity yourself and manage everything yourself, like who receives the packets * Break things using reflection
Same as the link I linked you to, except that you have to add an extra parameter for both calls to Level::addParticle(). Look at this: So just change addParticle($this->particle) to addParticle($this->particle, [$player]). The content inside the Heredoc is a quote from @iamadpond in his hammer thread to properly ask people to search. P.S. I can never remember whith one is Heredoc and which one is Nowdoc without checking it on php.net every time.
Er, FloatingTextParticle.php seems to already take care of removing the entity so you're right. I glanced over it a bit too quick .