Hey im not sure how to work args corectly so im asking. I cant find anything in the docs. For example: If you do /kill [player] the player is an argument but how do i program it ?
It is not documented because it is a function parameter. It is a string array created by splitting the text behind the command with spaces. For /kill [player], [player] is the first item in the array, namely $args[0] It doesn't have to be $args. You can call it whatever you like.
Ok so if i do / tell $args[0] $args [1] ? so it is name then message how would i put the name do i have to do $args[0] = getPlayer ()-> getDisplayName () ?
Im trying to understand how i agruments work. In still trying to write my staff plugin but im not sure how i should add staffs to my staffs list by command. But i think i will do it by config file. But i want that you can send a message to a staff without /tell
$args is an array containing all parameters of the given command. Every argument (or parameter as you like to call it) is split by space For example if you have this command: /give [player] [item] [quantity] $args[0] is the first parameter ([player]) $args[1] is the second parameter ([item]) $args[2] is the third parameter ([quantity]) As @PEMapModder said before, you can call the variable as you like (for example: $par, $arguments, $parameters...)
No i mean with a command like / staff [player] we have a problem and this player i dont know how to add
Wait, what do you want to do at all? $msg = implode(" ", $args); This converts the $args back to a string containing the message, $msg. $Server->broadcast($message, Server::BROADCAST_CHANNEL_ADMINISTRATIVE) ; This sends $message to all players with the Server::BROADCAST_CHANNEL_ADMINISTRATIVE (pocketmine.broadcast.admin) permission node.