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


PHP Server::setServer方法代码示例

本文整理汇总了PHP中Server::setServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::setServer方法的具体用法?PHP Server::setServer怎么用?PHP Server::setServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server的用法示例。


在下文中一共展示了Server::setServer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getServer

 /** Gets a Server class instance for the specified server.
  * This function returns an instance of Server (the same as the innerAPI one) for the specified server in argument.
  * 
  * \param $server The wanted server's name.
  * 
  * \return If the server exists, it returns an instance of Server class. Else, it returns FALSE.
  */
 public static function getServer($server)
 {
     $self = self::getInstance();
     if (!isset($self->_leelabot->servers[$server])) {
         return FALSE;
     }
     $instance = new Server();
     $instance->setServer($self->_leelabot->servers[$server]);
     return $instance;
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:17,代码来源:innerapi.class.php

示例2: IrcPlayers

 public function IrcPlayers($pseudo, $channel, $cmd, $message)
 {
     $serverlist = ServerList::getList();
     $actual = Server::getName();
     if (isset($cmd[1]) && in_array($cmd[1], $serverlist)) {
         Server::setServer($this->_main->servers[$cmd[1]]);
         $this->_printPlayers($cmd[1]);
     } else {
         foreach ($serverlist as $server) {
             Server::setServer($this->_main->servers[$server]);
             $this->_printPlayers();
         }
     }
     Server::setServer($this->_main->servers[$actual]);
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:15,代码来源:clientbase.php

示例3: loadServerInstances

 /** Loads all the server instances and defining their parameters
  * This function loads all the server instances found in Leelabot::$config, and initializes them with their config.
  * 
  * \returns TRUE if instances loaded successfully, FALSE otherwise.
  */
 public function loadServerInstances()
 {
     if (!isset($this->config['Server'])) {
         Leelabot::message('No server defined in configuration.', array(), E_ERROR);
         exit;
     }
     $this->servers = array();
     Leelabot::message('Loading server instances.');
     //Checking default configuration
     if (isset($this->config['Server']['default'])) {
         $defaultConfig = $this->config['Server']['default'];
         unset($this->config['Server']['default']);
     }
     foreach ($this->config['Server'] as $name => $instance) {
         if (isset($instance['name'])) {
             $name = $instance['name'];
         }
         Leelabot::message('Loading server "$0".', array($name));
         $this->servers[$name] = new ServerInstance($this);
         //Using config name if not specified
         $this->servers[$name]->setName($name);
         //Loading config
         if (!$this->servers[$name]->loadConfig($instance)) {
             Leelabot::message('Can\'t load config for server "$0".', array($name), E_WARNING);
             unset($this->servers[$name]);
             continue;
         }
         //Setting servers for static inner API
         RCon::setServer($this->servers[$name]);
         Server::setServer($this->servers[$name]);
         //Connecting to server
         if (!$this->servers[$name]->connect()) {
             Leelabot::message('Can\'t connect to server "$0".', array($name), E_WARNING);
             unset($this->servers[$name]);
         }
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:42,代码来源:leelabot.class.php

示例4: IrcStats

 public function IrcStats($pseudo, $channel, $cmd, $message)
 {
     $server = LeelaBotIrc::nameOfServer($cmd[2], FALSE);
     $actual = Server::getName();
     if (isset($cmd[1])) {
         if ($server !== false) {
             Server::setServer($this->_main->servers[$server]);
             $target = Server::searchPlayer(trim($cmd[1]));
             if (!$target) {
                 LeelaBotIrc::sendMessage("Unknown player");
             } elseif (is_array($target)) {
                 $players = array();
                 foreach ($target as $p) {
                     $players[] = Server::getPlayer($p)->name;
                 }
                 LeelaBotIrc::sendMessage("Multiple players found : " . join(', ', $players));
             } else {
                 $buffer = array();
                 $_stats = Server::get('stats');
                 $_awards = Server::get('awards');
                 $player = Server::getPlayer($target);
                 if ($_stats[$player->id]['deaths'] != 0) {
                     $ratio = $_stats[$player->id]['kills'] / $_stats[$player->id]['deaths'];
                 } else {
                     $ratio = $_stats[$player->id]['kills'];
                 }
                 if (in_array('hits', $this->config['ShowStats'])) {
                     //Gestion des hits en fonction de la configuration du plugin de stats
                     $hits = "Hits : " . $_stats[$player->id]['hits'] . " - ";
                 }
                 if (Server::getServer()->serverInfo['g_gametype'] == 7) {
                     //Gestion des caps uniquement en CTF
                     $caps = " - Caps : " . $_stats[$player->id]['caps'];
                 }
                 LeelaBotIrc::sendMessage("Stats de " . $player->name . " : " . $hits . "Kills : " . $_stats[$player->id]['kills'] . " - Deaths : " . $_stats[$player->id]['deaths'] . " - Ratio : " . $ratio . $caps . " - Streaks : " . $_stats[$player->id]['streaks']);
             }
             Server::setServer($this->_main->servers[$actual]);
         }
     } else {
         LeelaBotIrc::sendMessage("Player name missing");
     }
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:42,代码来源:stats.php


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