getinfo()) {
$status = $server_query->getstatus();
$phpUA["TEMPLATE"]->assign("SERVER_ID", $id);
$phpUA["TEMPLATE"]->assign("SERVER_IP", $ip);
$phpUA["TEMPLATE"]->assign("SERVER_PORT", $port);
$phpUA["TEMPLATE"]->assign("SERVER_HOSTNAME", $server_query->stripColorCodes($info["hostname"]));
$phpUA["TEMPLATE"]->assign("SERVER_MAPNAME", " ");
$phpUA["TEMPLATE"]->assign("SERVER_NUMPLAYERS", " ");
$phpUA["TEMPLATE"]->assign("SERVER_MAXPLAYERS", " ");
for($i=0; $i<$status["sv_maxclients"]; $i++) {
$players_array[$i] = array("name"=>" ",
"frags"=>" ",
"ping"=>" ");
}
$phpUA["TEMPLATE"]->assign("SERVER_PLAYERS", $players_array);
$phpUA["TEMPLATE"]->display($phpUA["STYLE"] . "/plugin_cod/watch.tpl");
$phpUA["TEMPLATE"]->display($phpUA["STYLE"] . "/body_footer.tpl");
endBenchmark(__FILE__, __FUNCTION__);
printBenchmark();
$startTimeLimit = time();
while (!connection_aborted()) {
if (!$info = $server_query->getinfo()) displayErrorMessage($phpUA["LANGUAGE"]["ConnectionTimeout"] . "
(" . basename(__FILE__) . ":" . __LINE__ . ")");
if (!isset($info["clients"]))
$info["clients"] = 0;
$players = $server_query->getplayers();
echo "\n";
if (time() >= ($phpUA["ENGINE"]["TIME"] + $phpUA["CONFIG"]["TIMELIMIT"] - $phpUA["CONFIG"]["TIMEOUT"])) {
echo "\n";
$phpUA["TEMPLATE"]->display($phpUA["STYLE"] . "/html_footer.tpl");
exit;
}
flush();
sleep($phpUA["CONFIG"]["INTERVAL"]);
if (!ini_get("safe_mode")) set_time_limit(ini_get("max_execution_time"));
}
}
else {
displayErrorMessage($phpUA["LANGUAGE"]["ConnectionTimeout"] . "
(" . basename(__FILE__) . ":" . __LINE__ . ")");
}
}
function plugin_cod_mode_watch_updateplayer($id, $name, $frags, $ping )
{
// p(id, name, frags, deaths)
echo "p('" . $id . "', '" . htmlentities($name, ENT_QUOTES) . "', '" . $frags . "', '" . $ping . "');\n";
}
function plugin_cod_mode_watch_clearplayer($count)
{
// c(count)
echo "c('" . $count . "');\n";
}
function plugin_cod_mode_watch_updateserver($mapname, $numplayers, $maxplayers)
{
// s(mapname, numplayers, maxplayers)
echo "s('" . $mapname . "', '" . $numplayers . "', '" . $maxplayers . "');\n";
}
?>