public function CommandSavePlayers($id, $command) { $players = array(); foreach (Server::getPlayerList() as $pid => $player) { if (!isset($players[$player->name])) { $players[$player->name] = $player; } else { $players[$player->name . '_' . $pid] = $player; } } file_put_contents('playerdump.ini', $this->_main->generateINIStringRecursive($players)); }
private function _printPlayers() { $playerlist = array(); $nbplayers = 0; $serverinfo = Server::getServer()->serverInfo; foreach (Server::getPlayerList() as $curPlayer) { //Gestion de la couleur en fonction de l'équipe if ($serverinfo['g_gametype'] != '0') { if ($curPlayer->team == 1) { $color = "04"; } elseif ($curPlayer->team == 2) { $color = "02"; } elseif ($curPlayer->team == 3) { $color = "14"; } } else { $color = "08"; } $playerlist[] = "" . $color . $curPlayer->name . ""; ++$nbplayers; } if ($nbplayers > 0) { LeelaBotIrc::sendMessage("" . LeelaBotIrc::rmColor($serverinfo['sv_hostname']) . " : " . join(', ', $playerlist)); } else { LeelaBotIrc::sendMessage("" . LeelaBotIrc::rmColor($serverinfo['sv_hostname']) . " : No one."); } }
/** Gives the list of players on the server. * This function is bound to the !list command. This function shows the list of players with their id. * * \param $id The game ID of the player who executed the command. * \param $command The command parameters. * * \return Nothing. */ public function CommandList($id, $command) { $list = ''; $players = Server::getPlayerList(); foreach ($players as $p) { $list .= '[' . $p->id . '] ' . $p->name . ', '; } Rcon::tell($id, '$listofplayers', array('listofplayers' => $list)); }