1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
|
$server_ip = "udp://" . $server_ip;
$serverip = substr($server_ip, 6);
$connect = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
if ($connect) {
socket_set_timeout ($connect, 1, 000000);
$send = "ÿÿÿÿ" . chr (0x02) . "getstatus";
$debug1 = fputs($connect, $send);
$debug2 = fwrite ($connect, $send);
$output = fread ($connect, 1);
if (! empty ($output)) {
do {
$status_pre = socket_get_status ($connect);
$output = $output . fread ($connect, 1);
$status_post = socket_get_status ($connect);
} while ($status_pre['unread_bytes'] != $status_post['unread_bytes']);
};
fclose($connect);
$output = explode ("\\", $output);
$max_index = array_search ("sv_maxclients", $output);$max_clients = $output[$max_index+1];
$max_index = array_search ("sv_privateClients", $output);$privat = $output[$max_index+1];
$max_index = array_search ("mapname", $output);$mapname = $output[$max_index+1];
$max_index = array_search ("sv_hostname", $output);$hostname = $output[$max_index+1];
$max_index = array_search ("g_gametype", $output);$gametype = $output[$max_index+1];
$max_index = array_search ("sv_punkbuster", $output);$punkbuster = $output[$max_index+1];
$max_index = array_search ("sv_pure", $output);$pure = $output[$max_index+1];
$max_index = array_search ("sv_voice", $output);$voice = $output[$max_index+1];
$max_index = array_search ("g_antilag", $output);$alag = $output[$max_index+1];
$max_index = array_search ("pswrd", $output);$passwort = $output[$max_index+1];
$max_index = array_search ("_Location", $output);$Standort = $output[$max_index+1];
$max_index = array_search ("_Admin", $output);$admin = $output[$max_index+1];
$max_index = array_search ("_Website", $output);$Web = $output[$max_index+1];
$max_index = array_search ("_Host", $output);$Host = $output[$max_index+1];
$max_index = array_search ("_Email", $output);$EMail = $output[$max_index+1];
$max_index = array_search ("_IRC", $output);$IRC = $output[$max_index+1];
$max_index = array_search ("_ICQ", $output);$ICQ = $output[$max_index+1];
$max_index = array_search ("gamename", $output);$gamename = $output[$max_index+1];
$max_index = array_search ("shortversion", $output);$Version = $output[$max_index+1];
$max_index = array_search ("_Mod", $output);$Mod = $output[$max_index+1];
$max_index = array_search ("sv_maxPing", $output);$maxPing = $output[$max_index+1];
$max_index = array_search ("sv_minPing", $output);$minPing = $output[$max_index+1];
$max_index = array_search ("fs_game", $output);$fsgame = $output[$max_index+1];
if ($Maps[$mapname] || "") {$mapnamelong = $Maps[$mapname];}
if ($mapnamelong == "") {$mapnamelong = $mapname;}
if ($fsgame == "_Admin") {$fsgame = "";}
if ($Host == "_Admin") {$Host = "";}
if ($Host == "Admin") {$Host = "";}
if ($Mod == "_Admin") {$Mod = "";}
if ($Mod == "Admin") {$Mod = "";}
if ($IRC == "_Admin") {$IRC = "";}
if ($IRC == "#") {$IRC = "-";}
if ($ICQ == "_Admin") {$ICQ = "-";}
if ($ICQ == "Admin") {$ICQ = "-";}
if ($maxPing == "_Admin") {$maxPing = "-";}
if ($Web == "_Admin") {$Web = "-";}
if ($minPing == "_Admin") {$minPing = "-";}
if ($gamename == "Call of Duty") {$GameIcon_small = "cod";$GameIcon_big = "cod_font";$gamename_short = "CoD";}
if ($gamename == "CoD:United Offensive") {$GameIcon_small = "coduo";$GameIcon_big = "coduo_font";$gamename_short = "CoD UO";}
if ($gamename == "Call of Duty 2") {$GameIcon_small = "cod2";$GameIcon_big = "cod2_font";$gamename_short = "CoD 2";}
if ($gamename == "Call of Duty 4") {$GameIcon_small = "cod4";$GameIcon_big = "cod4_font";$gamename_short = "CoD 4 MW";}
if ($gamename == "Call of Duty: World at War") {$GameIcon_small = "codww";$GameIcon_big = "codww_font";$gamename_short = "CoD WW";}
if ($gametype == "re") {$gametype = "Retrieval";$gametype_short = "RE";}
if ($gametype == "dm") {$gametype = "Deathmatch";$gametype_short = "DM";}
if ($gametype == "sd") {$gametype = "Suchen and Zerstören";$gametype_short = "SD";}
if ($gametype == "tdm") {$gametype = "Team Deathmatch";$gametype_short = "TDM";}
if ($gametype == "war") {$gametype = "Team Deathmatch";$gametype_short = "TDM";}
if ($gametype == "bel") {$gametype = "Hinter feindl. Linien";$gametype_short = "BEL";}
if ($gametype == "hq") {$gametype = "Hauptquartier";$gametype_short = "HQ";}
if ($gametype == "dom") {$gametype = "Domination";$gametype_short = "DOM";}
if ($gametype == "ctf") {$gametype = "Capture the Flag";$gametype_short = "CTF";}
if ($gametype == "bas") {$gametype = "Base Assault";$gametype_short = "BAS";}
if ($gametype == "koth") {$gametype = "King of the Hill";$gametype_short = "HQ";}
if ($gametype == "sab") {$gametype = "Sabotage";$gametype_short = "SAB";}
if ($gametype == "twar") {$gametype = "Krieg";$gametype_short = "TWAR";}
if ($gametype == "ctfb") {$gametype = "Capture the Flag back";$gametype_short = "CTFB";}
if ($gametype == "ch") {$gametype = "Capture and hold";$gametype_short = "CH";}
if ($gametype == "htf") {$gametype = "Hold the Flag";$gametype_short = "HTF";}
if ($gametype == "vip") {$gametype = "V.I.P.";$gametype_short = "VIP";}
if ($gametype == "wrz") {$gametype = "Warzone";$gametype_short = "WRZ";}
$last_value = count($output) - 1;
$players_string = $output[$last_value];
$players_string = explode("\n", $players_string);
for ($i = 1; $i != count($players_string); $i++) {
$split = explode(" ", $players_string[$i], 3);
$playerlist[$i-1]['score'] = $split[0];
$playerlist[$i-1]['ping'] = $split[1];
$playerlist[$i-1]['player'] = $split[2];
}
function cmp ($a, $b) {
if ($a["score"] > $b["score"]) {
return -1;
}
if ($a["score"] < $b["score"]) {
return 1;
}
if ($a["score"] == $b["score"]) {
return 0;
}
}
@usort($playerlist, "cmp");
$players = count($playerlist) - 1;
}
|