Q2 Serverin statistiikkaa
<!-- Sekavaa eikä mitenkään kommentoitua --> <!-- Aika viritys muutenkin :) --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Q2 Query</title> </head> <body> <form name="form1" method="post" action="<?php echo"$PHP_SELF"; ?>"> <font face=\"Arial\"size="2"><b>IP: <input type="text" name="address" value=<?php echo"$address";?>> PORT: <input type="text" name="port" value=<?php echo"$port";?>> <input type="submit" name="Submit" value="Query"> </b> </font> </form> <hr> <?php if(isset($address)) { if(empty($port)) { $port="27910"; } if(empty($address)) {$address="194.251.249.71"; } $fp = fsockopen("udp://".$address, $port, &$errno, &$errstr, 10); if (!$fp) { echo "Unable to connect"; } else { fwrite($fp,"ÿÿÿÿstatus\x00"); $header = fread($fp,10); $data = fgets($fp, 9000); $map = str_replace("mapname\\","<map>",$data); $map = str_replace("\\","</map>",$map); $version = str_replace("actionversion\\","<version>",$data); $version = str_replace("\\","</version>",$version); $hostname = str_replace("hostname\\","<hostname>",$data); $hostname = str_replace("\\","</hostname>",$hostname); $maxclients = str_replace("maxclients\\","<maxc>",$data); $maxclients = str_replace("\\","</maxc>",$maxclients); preg_match("@<map>(.*)</map>@siU", $map, $map_array); preg_match("@<version>(.*)</version>@siU", $version, $version_array); preg_match("@<hostname>(.*)</hostname>@siU", $hostname, $hostname_array); preg_match("@<maxc>(.*)</maxc>@siU", $maxclients, $maxc_array); $mapname = str_replace("\\","", $map_array[0]); $version = str_replace("\\","", $version_array[0]); $hostname = str_replace("\\","", $hostname_array[0]); $maxclients = str_replace("\\","", $maxc_array[0]); echo"<table width=400 border=0 cellspacing=0 cellpadding=0> <tr> <td><b><font face=\"Arial\" size=2>"; echo "Hostname: $hostname<BR />"; echo "map: $mapname<BR />"; echo "Version: $version<BR />"; $i = 0; $a = 100; $pelaajat = 0; $taulukko = array(); while($i < $a) { socket_set_blocking($fp,0); fwrite($fp,"ÿÿÿÿplayers\x00"); $p_data = fgets($fp, 100); if(empty($p_data)) { $a = "$i";} else { $play_temp = explode("\"",$p_data); $nick =$play_temp[1]; $ping_frags = explode(" ",$play_temp[0]); $frags = $ping_frags[0]; $ping = $ping_frags[1]; $nick = htmlspecialchars($nick); $fragijamuut = "<frags>$frags</frags><ping>$ping</ping>"; $taulukko[] ="<nikki>$nick</nikki>$fragijamuut"; $i++; $pelaajat++; } } echo "Players: ".count($taulukko)."/$maxclients<BR /><BR />"; echo"</font></b></td> </tr> </table>"; $y = 0; echo "<table width=400 border=0 cellspacing=0 cellpadding=0> <tr> <td><b><font face=\"Arial\" size=2>Frags:</font></b></td> <td><b><font face=\"Arial\" size=2>Nick</font></b></td> <td><b><font face=\"Arial\" size=2>Ping</font></b></td> </tr>"; while($y < count($taulukko)) { preg_match("@<nikki>(.*)</nikki>@siU", $taulukko[$y], $nikki); preg_match("@<frags>(.*)</frags>@siU", $taulukko[$y], $frags); preg_match("@<ping>(.*)</ping>@siU", $taulukko[$y], $ping); echo"<tr> <td><font face=\"Arial\" size=2>$frags[0]</font></td> <td><font face=\"Arial\" size=2>$nikki[0]</font></td> <td><font face=\"Arial\" size=2>$ping[0]ms</font></td> </tr>"; $y++; } echo "</table>"; } } else { } ?> </body> </html>
Höh, meni vähän aikaa miettiä, mikä ihmeen q2, mutta kun sorsaa tutkiskelin, huomasin oikean asianlaidan... voihan tosta olla hyötyäkin..
Quake 2
Olisko mahdollista tuota käyttää esim Countterissa?
SQ, en ole varma, mutta käyttäväthän molemmat samaa pelimoottoria... kokeile :)
Quake2 ja Countter eivät todellakaan käytä samaa pelimoottoria.
Aihe on jo aika vanha, joten et voi enää vastata siihen.