/** !help command. Get help and list of commands. * This function is the command !help. It get list of commands and help. * * \param $player The player who send the command. * \param $command The command's parameters. * * \return Nothing. */ public function CommandHelp($player, $command) { $list = Plugins::getCommandList(); $player = Server::getPlayer($player); if (empty($command[0])) { foreach ($list as $cmd => $level) { unset($list[$cmd]); if ($level <= $player->level) { $list['!' . $cmd] = $level; } } $list = implode(', ', array_keys($list)); Rcon::tell($player->id, 'List of commands : $list', array('list' => $list)); } else { $cmdHelp = strtolower(str_replace('!', '', $command[0])); //need into translate files for example : #id help_nextmap #to Return next map. Rcon::tell($player->id, '$cmd: ' . Locales::translate('help_' . $cmdHelp), array('cmd' => '!' . $cmdHelp), FALSE); } }
private function _showStatsMsg($user, $admin = NULL) { $buffer = array(); $_stats = Server::get('stats'); $_awards = Server::get('awards'); //Gestion du ratio pour éviter la division par zéro if ($_stats[$user]['deaths'] != 0) { $ratio = $_stats[$user]['kills'] / $_stats[$user]['deaths']; } else { $ratio = $_stats[$user]['kills']; } $aratio = round($_awards['ratio'][1], 2); //Gestion du ratio (changement de couleur selon le ratio) $ratio = round($ratio, 2); if ($ratio >= 1) { $ratioColor = '^2'; } else { $ratioColor = '^1'; } $gametype = Server::getServer()->serverInfo['g_gametype']; //Gestion des awards (plus précisément de la couleur en cas d'award ou non) foreach ($this->config['ShowStats'] as $stat) { if (in_array($stat, $this->config['ShowStats'])) { if ($_awards[$stat][0] == $user && in_array($stat, $this->config['ShowAwards'])) { $statColor = '^6'; } else { $statColor = '^3'; } if (in_array($stat, $this->config['ShowAwards'])) { if ($stat == 'ratio') { // cpu/memory saving $statAward = '^4/' . round($_awards[$stat][1], 2); } else { $statAward = '^4/' . $_awards[$stat][1]; } } else { $statAward = ''; } if ($stat == 'ratio') { $buffer[] = $statColor . ucfirst($stat) . ' : ' . $ratioColor . $ratio . $statAward; } elseif ($stat == 'caps' && $gametype == Server::GAME_CTF or $stat == 'round' && $gametype == Server::GAME_LMS or !in_array($stat, array('ratio', 'caps', 'round'))) { $buffer[] = $statColor . ucfirst($stat) . ' : ^2' . $_stats[$user][$stat] . $statAward; } } } if ($admin !== NULL) { $user = $admin; } // If a admin use !stats <player> //On affiche enfin les stats Rcon::tell($user, '$stats', array('stats' => join('^3 - ', $buffer))); }
/** Gives information about a player * This function is bound to the !whois command. It gives the name, ip, level, host of the player specified in argument. * * \param $id The game ID of the player who executed the command. * \param $command The command parameters. * * \return Nothing. */ public function CommandWhois($id, $command) { if (!empty($command[0])) { $target = Server::searchPlayer($command[0]); if ($target === FALSE) { RCon::tell($id, "No player found."); } elseif (is_array($target)) { $players = array(); foreach ($target as $p) { $players[] = Server::getPlayer($p)->name; } RCon::tell($id, 'Multiple players found : $0', array(join(', ', $players))); } else { $target = Server::getPlayer($target); Rcon::tell($id, 'Whois ^2$name ^3> IP : $addr, Level : $level, Host : $host', array('name' => $target->name, 'addr' => $target->addr, 'level' => $target->level, 'host' => gethostbyaddr($target->addr))); } } else { Rcon::tell($id, 'Missing parameters.'); } }
public function CommandIrcco($player, $args) { LeelaBotIrc::send('NAMES ' . $this->config['MainChannel']); $continue = TRUE; while ($continue) { $ret = rtrim(LeelaBotIrc::get()); if ($ret) { $data = explode(':', $ret); $cmd = explode(' ', $data[1]); if ($cmd[1] == '353') { $nicks .= ' ' . $data[2]; } elseif ($cmd[1] == '366') { $continue = FALSE; } } } $nicks = str_replace(array('@', '+', '~'), array('', '', ''), $nicks); Rcon::tell($player, 'People connected to IRC : $nicks', array('nicks' => $nicks)); }
public function SrvEventSay($id, $contents) { if ($contents[0] != '!') { $addwarn = FALSE; foreach ($this->_badwords as $word) { if (strpos(strtolower($contents), $word) !== FALSE) { $addwarn = TRUE; } } if ($addwarn) { $warns = $this->_addWarn($id); Rcon::tell($id, 'Please be careful with your language. You have $warns warnings', array('warns' => $warns)); } } }