forked from xPaw/PHP-Source-Query
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.php
More file actions
32 lines (26 loc) · 965 Bytes
/
Example.php
File metadata and controls
32 lines (26 loc) · 965 Bytes
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
<?php
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
$query = new SourceQuery();
function ServerInfo($ip, $port, &$query, &$totalPlayers, &$totalMaxPlayers)
{
$ret = "Error loading server info for " . $ip . ":" . $port;
try
{
$query->Connect($ip, $port, 1, SourceQuery::SOURCE);
$info = $query->GetInfo();
$ret = $info['Map'] . " [" . $info['Players'] . "/" . $info['MaxPlayers'] . " players]";
$totalPlayers += $info['Players'];
$totalMaxPlayers += $info['MaxPlayers'];
}
catch(Exception $e)
{
}
return $ret;
}
$totalPlayers = 0;
$totalMaxPlayers = 0;
echo "Insurgency: " . ServerInfo("fuckyouvilnowputyourfuckingipinhereyourself", 27015, $query, $totalPlayers, $totalMaxPlayers) . " <a href=\"steam://connect/fuckyouvilnowputyourfuckingipinhereyourself\">Join</a><br />";
echo "Total Players: " . $totalPlayers . "/" . $totalMaxPlayers;
;
$query->Disconnect( );
?>