Hello im trying to make an EggWars shop but i want to add a option which the players buys the item like if he has 2 gold then he gets a sword but if he doesnt then it says you cant purchase this item. Here is my code. Code: public function openWeaponForm($player){ $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $player, int $data = null){ $result = $data if ($result === null) { return true; } switch($result) { case 0: break; case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; } }); $form->setTitle("Armor"); $form->setContent("Select an Armor"); $form->addButton("Wooden Sword"); $form->addButton("Stone Sword"); $form->addButton("Iron Sword"); $form->addButton("Diamond Sword"); $form->addButton("Bow"); $form->addButton("Arrow"); $form->sendToPlayer($player); } Anyone knows how to do this?
create foreach loop, in to it set if for example Dianonds (in player inv) is 10, set to 0 or $item->getCount->setCount($diamond - 4); and add bow to player inv. and, if player dont have 10 diamond send message to player -> you dont have Enough Diamond. Solved?