Jump to content

game server counter (html or console)


Recommended Posts

I wrote this because I needed to see how many servers on a specific gametype I have. I needed it also to dump to html if I needed to (you can probably get creative and replace the $html to an ARGV line, tho)




<div class="pre"><pre>




$html = 0;


mysql_connect("localhost", "tcadmin", "password") or

die("Could not connect: " . mysql_error());



$result = mysql_query("SELECT NAME, COUNT(*) AS COUNT FROM tc_services, tc_games WHERE tc_services.game_id = tc_games.game_id GROUP by NAME");


if ( ! $html ) {

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

printf("%s %s\n",$row[0], $row[1]);


} else {

echo "<table border=1>\n";

echo "<tr><td>Gametype</td><td># of Servers</td></tr>\n";


while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

printf("<tr><td>%s</td><td>%s</td></tr>\n",$row[0], $row[1]);













Sample console output (where xxx = number of servers)




<div class="pre"><pre>

Battlefield 2 xxx

Call of Duty xxx

Call of Duty 2 xx

Call Of Duty: United Offensive xxx

Condition Zero xxx

Counter Strike xxx

Counter Strike Boosted xxxx

Counter Strike Half Boosted xxx

Counter Strike Premium xxx

CS Source xxx

Day of Defeat xxx

Day of Defeat: Source xxx

Generic xxx

HLTV xxxx

Medal of Honor xxx

Quake 3 xxx

Quake 4 xxx

Soldier of Fortune II xxx

Star Wars Jedi Knight II: Jedi Outcast xxx

Unreal Tournament 2004 xxx

Ventrilo 2.3.0 xxx

Wolfenstein: Enemy Territory xxxx




Link to comment
Share on other sites

Looks like an easy way of retrieving the total number of servers running, and I notice that Ventrillo is held in tc_services. Does that mean that Teamspeak is also held in there?






Teamspeak servers are stored in TC_VIRTUAL_VOICE_SERVERS


Master voice server info is in TC_MASTER_VOICE_SERVERS

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use