Code: PHP: $rule = strtolower($args[0]); if($rule == "1") { $player->sendMessage($this->getConfig()->get("header1")); $player->sendMessage($this->getConfig()->get("rule-1")); $player->sendMessage($this->getConfig()->get("rule-2")); $player->sendMessage($this->getConfig()->get("rule-3")); $player->sendMessage($this->getConfig()->get("rule-4")); $player->sendMessage($this->getConfig()->get("rule-5")); } elseif($rule == "2") { $player->sendMessage($this->getConfig()->get("header2")); $player->sendMessage($this->getConfig()->get("rule-6")); $player->sendMessage($this->getConfig()->get("rule-7")); $player->sendMessage($this->getConfig()->get("rule-8")); $player->sendMessage($this->getConfig()->get("rule-9")); $player->sendMessage($this->getConfig()->get("rule-10")); } elseif($rule == "3") { $player->sendMessage($this->getConfig()->get("header3")); $player->sendMessage($this->getConfig()->get("rule-11")); $player->sendMessage($this->getConfig()->get("rule-12")); $player->sendMessage($this->getConfig()->get("rule-13")); $player->sendMessage($this->getConfig()->get("rule-14")); $player->sendMessage($this->getConfig()->get("rule-15")); return true; break; } /rules 1 and 3 works fine but /rules 2 give me this error: Code: 06:53:51 [CRITICAL] Unhandled exception executing command 'rules 2' in rules: strlen() expects parameter 1 to be string, boolean given 06:53:51 [CRITICAL] TypeError: "strlen() expects parameter 1 to be string, boolean given" (EXCEPTION) in "/src/pocketmine/lang/BaseLang" at line 160
Try this: PHP: $rule = $args[0]; // strtolower() not needed if($rule == "1") { $player->sendMessage($this->getConfig()->get("header1")); $player->sendMessage($this->getConfig()->get("rule-1")); $player->sendMessage($this->getConfig()->get("rule-2")); $player->sendMessage($this->getConfig()->get("rule-3")); $player->sendMessage($this->getConfig()->get("rule-4")); $player->sendMessage($this->getConfig()->get("rule-5")); } elseif($rule == "2") { $player->sendMessage($this->getConfig()->get("header2")); $player->sendMessage($this->getConfig()->get("rule-6")); $player->sendMessage($this->getConfig()->get("rule-7")); $player->sendMessage($this->getConfig()->get("rule-8")); $player->sendMessage($this->getConfig()->get("rule-9")); $player->sendMessage($this->getConfig()->get("rule-10"));}elseif($rule == "3") { $player->sendMessage($this->getConfig()->get("header3")); $player->sendMessage($this->getConfig()->get("rule-11")); $player->sendMessage($this->getConfig()->get("rule-12")); $player->sendMessage($this->getConfig()->get("rule-13")); $player->sendMessage($this->getConfig()->get("rule-14")); $player->sendMessage($this->getConfig()->get("rule-15")); return true; // removed break;}else { $player->sendMessage("Page not found");}