Thread: How to L2Who?
View Single Post
Old 09.09.2009, 14:59   #2
FidoW
Guest
 
Posts: n/a
Default How to L2Who?

This example is checking RPGClub Russ server, as you can see... the website online count is like 170% of the real amount.

Website says 2526 online now... the script say 1470... heh!

<?

$gameserverlist = array(

"x1"=>'77.50.0.76',

"x3"=>'77.50.0.77',

"x10"=>'77.50.0.53',

"x30"=>'77.50.0.71',

"x1000"=>'77.50.0.70'

);

foreach($gameserverlist as $name=>$ip) {

$a = getserverdata($ip);

echo "$name ($a[ip]) [$a[protocol] protocol]: current({$a[current]}), playing({$a[playing]}), private store({$a[store]}), max({$a[max]})\n<br>";

$total[current] += $a[current];

$total[playing] += $a[playing];

$total[store] += $a[store];

$total[max] += $a[max];

}

echo "<br>TOTAL: current($total[current]), playing($total[playing]), private store($total[store]) max($total[max])";

function getserverdata($ip="127.0.0.1",$port=7777,$code=14) { // code 0=C1-Interlude // code 14=Kamael-Gracia

$fs=@fsockopen($ip,$port,$errno,$errstr,2);

if (!$fs) return array('protocol'=>0,'status'=>0,'id'=>0,'world'=>0 ,'max'=>0,'current'=>0,'playing'=>0,'store'=>0);

$pck=pack("vCi",6,$code,-3);

fwrite($fs,$pck);

$r=fread($fs,73);

fclose($fs);

if(strlen($r)==0 && $code==14) return getserverdata($ip,$port,0);

$a=@unpack("vsize/Cid/iworld/imax/icurrent/iplaying/istore",$r);

$a['status'] = 1; $a['ip'] = $ip; $a['port'] = $port;

if($code==14) $a['protocol'] = "Kamael";

else $a['protocol'] = "C1-Int";

return $a;

}

?>

Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 09-09-2009, 02:59 PM. Открыть источник.