Beispiel #1
0
 /** Slap command. Slaps a player from the server.
  * This function is bound to the !slap command. It slaps a player from the server, according to the name given in first parameter. It does not needs the complete
  * in-game name to work, a search is performed with the given data. It will ail if there is more than 1 person on the server corresponding with the given mask.
  * 
  * \param $id The game ID of the player who executed the command.
  * \param $command The command parameters.
  * 
  * \return Nothing.
  */
 public function CommandSlap($id, $command)
 {
     if (!empty($command[0])) {
         $target = Server::searchPlayer($command[0]);
         if ($target === FALSE) {
             RCon::tell($id, "No player found.");
         } elseif (is_array($target)) {
             $players = array();
             foreach ($target as $p) {
                 $players[] = Server::getPlayer($p)->name;
             }
             RCon::tell($id, 'Multiple players found : $0', array(join(', ', $players)));
         } else {
             RCon::slap($target);
         }
     } else {
         Rcon::tell($id, 'Missing parameters.');
     }
 }