how to upgrade amor by killing players ? 1. full leather -> full chain please help me PHP: public function onPlayerDeathEvent(PlayerDeathEvent $event) { $player = $event->getEntity(); if ($player instanceof Player) { $cause = $player->getLastDamageCause(); if($cause instanceof EntityDamageByEntityEvent) { $damager = $cause->getDamager(); if($damager instanceof Player) { $damager->sendMessage(Color::GREEN."test"); $this->money->addMoney($damager, 5); $this->money->reduceMoney($player, 5);
https://github.com/PocketMine/Pocke...pocketmine/inventory/PlayerInventory.php#L193 https://github.com/PocketMine/Pocke...pocketmine/inventory/PlayerInventory.php#L197 https://github.com/PocketMine/Pocke...pocketmine/inventory/PlayerInventory.php#L201 https://github.com/PocketMine/Pocke...pocketmine/inventory/PlayerInventory.php#L205
PHP: public function getHelmet(){ return $this->getItem($this->getSize()); } public function getChestplate(){ return $this->getItem($this->getSize() + 1); } public function getLeggings(){ return $this->getItem($this->getSize() + 2); } public function getBoots(){ return $this->getItem($this->getSize() + 3); } public function setHelmet(Item $helmet){ return $this->setItem($this->getSize(), $helmet); } public function setChestplate(Item $chestplate){ return $this->setItem($this->getSize() + 1, $chestplate); } public function setLeggings(Item $leggings){ return $this->setItem($this->getSize() + 2, $leggings); } public function setBoots(Item $boots){ return $this->setItem($this->getSize() + 3, $boots); }// What you do not understand?// Just add leather armor id and here you goes PHP: if($player->getInventory()->getHelmet(Item::get(298, 0, 1)) and $player->getInventory()->getChestplate(Item::get(299, 0, 1)) and $player->getInventory()->getLeggings(Item::get(300, 0, 1)) and $player->getInventory()->getBoots(Item::get(301, 0, 1))) {$player->getInventory()->setHelmet(Item::get(302, 0,1));$player->getInventory()->setChestplate(Item::get(303, 0, 1));$player->getInventory()->setLeggings(Item::get(304, 0, 1));$player->getInventory()->setBoots(Item::get(305, 0,1));}// Leather armor to chainmail armor// You could edit all $player to $damager like in your code