本文整理汇总了PHP中Server::getPlayerList方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::getPlayerList方法的具体用法?PHP Server::getPlayerList怎么用?PHP Server::getPlayerList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::getPlayerList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CommandSavePlayers
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));
}
示例2: _printPlayers
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.");
}
}
示例3: CommandList
/** 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));
}