Beispiel #1
0
 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.");
     }
 }
Beispiel #2
0
 public function IrcServerList($pseudo, $channel, $cmd, $message)
 {
     $serverlist = ServerList::getList();
     LeelaBotIrc::sendMessage("Servers : " . join(', ', $serverlist));
 }
Beispiel #3
0
 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");
     }
 }
Beispiel #4
0
 public function IrcNextMap($pseudo, $channel, $cmd, $message)
 {
     $serverlist = ServerList::getList();
     $server = LeelaBotIrc::nameOfServer($cmd[1]);
     if ($server !== false) {
         $rcon = ServerList::getServerRCon($server);
         $serverlist = ServerList::getList();
         if (in_array($cmd[1], $serverlist)) {
             $map = $cmd[2];
         } else {
             $map = $cmd[1];
         }
         if (isset($map)) {
             if (in_array($map, $this->_mapUt4List)) {
                 $rcon->set('g_nextmap "ut4_' . $map . '"');
             } else {
                 $rcon->set('g_nextmap "' . $map . '"');
             }
             LeelaBotIrc::sendMessage("Next map changed !");
         } else {
             LeelaBotIrc::sendMessage("What's name of the map ?");
         }
     }
 }