Hello, how could i create a particle for only one player that the others should not see this? this is how i create a normal particle: PHP: Player->getLevel()->addParticle(new \pocketmine\level\particle\FloatingTextParticle(new Vector3(256.5, 64.9, 255.5), "Particle :)")); How can i create a particle for one player just? Should i use packets and manage data of them right? can someone give me an example of how can work that?
I'm pretty sure you add just one particle per player by adding [$player] as the second argument for addParticle. So it goes something like this PHP: Player->getLevel()->addParticle(new \pocketmine\level\particle\FloatingTextParticle(new Vector3(256.5, 64.9, 255.5), "Particle :)"), [$player]);
Player->getLevel()!?!? Replace with $player or whatever you defined as player otherwise you will get errors
PHP: /** @var FloatingTextParticle $particle *//** @var Player $player */foreach($particle->encode() as $packet){ $player->dataPacket($packet);}
PHP: $text = new FloatingTextParticle(new Position(123, 123, 123, $this->getServer()->getDefaultLevel()), " ", "Yo");$this->getServer()->getDefaultLevel()->addParticle($text, [$player]);
why didn't you define the player then? technically Player->getLevel() is not very right and looks ugly
Lmao, variable is instance of pocketmine\Player that's why i write that, but my variable is $player, go learn pls..
I was not asking nothing anymore, before you come back to this thread and say that. And for learning i was telling you for php, not pocketmine.
How would anyone know that? This question was the 5th one in the forum and was not marked "Solved". Moron.
Okay, man, I did not know that this was mandatory in the forum, if the objective was to help the person who asked the question, do not need to mark as resolved if the answers have already helped, just mark as resolved if you want, I will not be punished for it, Contrary to you who lowered the level to the point of cursing me, grows before answering someone on the internet, please.