Hi Hey guys I want a simple code. code taken from the server 4 players random and sends them a message for each one of them.
Use array_rand http://php.net/manual/en/function.array-rand.php Or mt_rand http://php.net/manual/en/function.mt-rand.php
PHP: $array = array($this->getServer()->getOnlinePlayers());$player = $array[array_rand($array)]; Why don't you try to search that?
Then do it four times. A for loop must solve your question. PHP: for($i = 1; $i <= 4; $i++) { $players = $this->getServer()->getOnlinePlayers(); $player = $players[array_rand($players)]; $player->sendMessage("Hello!");} http://php.net/manual/en/control-structures.for.php
No. You would just copy it. Please do it by yourself, you don't learn anything by copying. He sent ypu everything you need.