当前位置: 首页>>代码示例>>PHP>>正文


PHP Server::getPlayerList方法代码示例

本文整理汇总了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));
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:12,代码来源:dummy.php

示例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.");
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:27,代码来源:clientbase.php

示例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));
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:17,代码来源:adminbase.php


注:本文中的Server::getPlayerList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。