Hi PHP: public function onHit(EntityDamageEvent $event){$player = $event->getEntity();$snowball = $event->getDamager();if($player instanceof Player){ if($event->getCause() == EntityDamageEvent::CAUSE_PROJECTILE){ if($snowball instanceof FlameParticle){$player->kill(); } }}} its not work .
How should a particle be a damage cause? It's not solid, which means that it will just go through you, and anyways it is not related to projectiles. Change "FlameParticle" to "Snowball"
A particle is not an entity. The animation of a particle will only affect what the client sees. It won't even affect any physics on server-side, client-side or even singleplayer. To the server, the particle flashing for a moment and lingering for a whole minute is the same.
this on damage player not hit block this hit block code PHP: public function onTouch(PlayerInteractEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock()->getId(); if($block == 1){ // 1 this stone block id $player->getLevel->addParticle(new FlameParticle($player)); } }// use pocketmine\event\player\PlayerInteractEvent;