So im making a plugin (Not going into detail), and im having some issues with my help page. PHP: case "help": if($sender->hasPermission("troll.cmd") || $sender->hasPermission("troll.cmd.help")){ if(count($args) < 1){ $sender->sendMessage($this->prefix . "Usage: /trollboss help <number>"); if(isset($args[1]){ switch($args[1]){ case "1": $sender->sendMessage("Test1"); break; case "2": $sender->sendMessage("Test2"); break; } } } }else{ $sender->sendMessage($this->prefix . $this->NO_PERM); } break; Whenever I type /trollboss help <number> nothing happens. I was wondering if there is a fix for this or a better
PHP: $array = ["hello"]; // normal arrayecho $array[0]; // prints hello$array = [1=>"hello"]; // array with key => valueecho $array[1]; // prints hello Both have a size of 1 but they are different.
That's irrelevant here - his count comes before isset, so if the command is /trollboss help 1, (or just /trollboss help), the count is 2 (or 1...) and the code is never run
A lot is wrong with that. Syntax errors, and stuff that doesn’t exist. (For example $issuer... use $sender instead.) You have semicolons that don’t need to be there. And (doesn’t really effect the code as much) your formatting -.- I’m not doing the code for you. I’m just giving you some pointers.