Hi, people. Now a whole week tormented with identifying and attacking the deceased. Code: Code: public function OffPvP(EntityDamageByEntityEvent $e){ $cause = $e->getEntity()->getPlayer()->getName(); if ($e->getEntity() instanceof Player) { if($e->getDamager() instanceof Player) { $killer = $e->getDamager()->getPlayer()->getName(); if($this->isGameOn == 0){ $e->setCancelled(); } if($this->isGameOn == 1){ if($this->whoIs[$cause] == 1){ if($this->whoIs[$killer] == 1){ $e->setCancelled(); } } Error: Code: 2015-06-09 23:01:34 [NOTICE] InvalidArgumentException: "Argument 1 passed to eddir\microBattle::OffPvP() must be an instance of pocketmine\event\entity\EntityDamageByEntityEvent, instance of pocketmine\event\entity\EntityDamageEvent given, called in phar:///home/gs2004/PocketMine-MP.phar/src/pocketmine/plugin/MethodEventExecutor.php on line 36 and defined" (E_RECOVERABLE_ERROR) in "/microBattle [OW]/src/eddir/microBattle" at line 1201 2015-06-09 23:01:34 [CRITICAL] "Could not pass event 'pocketmine\event\entity\EntityDamageEvent' to 'microBattle v0.1 beta for OW': Argument 1 passed to eddir\microBattle::OffPvP() must be an instance of pocketmine\event\entity\EntityDamageByEntityEvent, instance of pocketmine\event\entity\EntityDamageEvent given, called in phar:///home/gs2004/PocketMine-MP.phar/src/pocketmine/plugin/MethodEventExecutor.php on line 36 and defined on eddir\microBattle Maybe somebody knows how to do?
PHP: public function onHurt(EntityDamageEvent $e){ if($e instanceof EntityDamageByEntityEvent){ if($e->getDamager() instanceof Player && $e->getEntity() instanceof Player){ $killer = $e->getDamager()->getPlayer()->getName(); $cause = $e->getEntity()->getPlayer()->getName(); if($this->isGameOn == 0){ $e->setCancelled(); } if($this->isGameOn == 1){ if($this->whoIs[$cause] == 1){ if($this->whoIs[$killer] == 1){ $e->setCancelled(); } } } }}