hi guys, I is not no errors just do not get it when using the kit. PHP: if ($sender->hasPermission("sw.command.kit")) { if (isset($this->gamePlayers[$name])) { if ($this->gameState[$this->gamePlayers[$name]] == 0) { if (isset($args[1])) { $kit = strtoupper($args[1]); echo "Peut être que"; foreach ($this->getKits() as $file) { if (isset($file["Kits"][$kit])) { echo "Test3"; $H = $file["Kits"][$kit]["Items"]["Helmet"]; if ($H == "" || $H == null) { $H = 0; } $CP = $file["Kits"][$kit]["Items"]["Chestplate"]; if ($CP == "" || $CP == null) { $CP = 0; } $L = $file["Kits"][$kit]["Items"]["Leggs"]; if ($L == "" || $L == null) { $L = 0; } $B = $file["Kits"][$kit]["Items"]["Boots"]; if ($B == "" || $B == null) { $B = 0; } $sender->getInventory()->addItem(Item::get($H, 0, 1)); $sender->getInventory()->addItem(Item::get($CP, 0, 1)); $sender->getInventory()->addItem(Item::get($L, 0, 1)); $sender->getInventory()->addItem(Item::get($B, 0, 1)); for ($x = 1; $x < 36; $x++) { if (isset($file["Kits"][$kit]["Items"]["Slot$x"])) { $sender->getInventory()->addItem(Item::get($file["Kits"][$kit]["Items"]["Slot$x"]["ItemID"], 0, $file["Kits"][$kit]["Items"]["Slot$x"]["Amount"])); } } echo "Peut être que 2"; PHP: public function createKit($enabled) { @file_put_contents($this->getDataFolder() . "kits.yml", @yaml_emit([ "Kits" => [ "BARBARIAN" => [ "Items" => [ "Helmet" => 298, "Chestplate" => 299, "Leggs" => 300, "Boots" => 301, "Slot1" => [ "Amount" => 1, "ItemID" => 267 ], ], "data" => $enabled ], ], ], YAML_UTF8_ENCODING)); } public function getKits() { $resule = []; foreach (scandir($this->getDataFolder()) as $file) { if (substr($file, -3) === "yml") { $data = @yaml_parse(Config::fixYAMLIndexes(@file_get_contents($this->getDataFolder() . $file))); if (isset($data['Kits'])) { $resule[] = $data; } } } return $resule; }
EDITTED : I thought echo didn't work in Pocketmine API (like you don't need ?>), if you want to send player a message, you can simply just do: PHP: $player->sendMessage("Test");
Please, just stop. echo works, why don't you try it for yourself? If you can't properly help someone, I recommend you to stop trying to. I can't seem to find the problem, try placing a var_dump() here and there, and you might find the problem from there on.
Obviously based on what you posted I can tell you're still learning. But right now you are doing more harm than help, by providing invalid solutions, you are misleading everyone(who doesn't know about coding but wants to). Avoid trying to help until you actually fully understand it yourself, it will benefit everyone.