I am cancelling preprocess event and making my own /help messages but when i type an $args[1] it says 'Invalid Command Syntax' can't find the problem
PHP: $command = explode(" ", strtolower($event->getMessage()));if(strtolower($command[0]) === "/help" or strtolower($command[0]) === "/?") { $event->setCancelled();if(isset($command[1])) { if(strtolower($command[1]) === "hero") { $page_s_messages = $this->pl->help->get("page_32"); $player->sendMessage(Color::YELLOW.$page_s_messages["message_1"]);}}
PHP: $command = explode(" ", strtolower($event->getMessage()));if(strtolower($command[0]) === "/help" or strtolower($command[0]) === "/?") { $event->setCancelled();if(isset($command[1])) { if(strtolower($command[1]) === "hero") { $page_s_messages = $this->pl->help->get("page_32"); $player->sendMessage(Color::YELLOW.$page_s_messages["message_1"]);}}} If this will not work then send more code.
$cmd = strtolower(explode(' ', $event->getMessage())[0]); $test = explode(' ', $event->getMessage()); $data = str_replace($cmd, "", $test); $args = $data; now you do the code