Airbone Squad Germany Forum (http://www.asg-funclan.de/wbb2/index.php)
- Sonstige Spiele (http://www.asg-funclan.de/wbb2/board.php?boardid=12)
-- Grand Theft Auto (http://www.asg-funclan.de/wbb2/board.php?boardid=32)
--- php Serverinfo-Script Rumble 0.2a (http://www.asg-funclan.de/wbb2/thread.php?threadid=196)


Geschrieben von Truesp!n am 16.04.2006 um 00:54:

  php Serverinfo-Script Rumble 0.2a

Was fürn Gothi. großes Grinsen Wenn ich das richtig verstanden habe, ist das ne Serverübersicht für die HP? :p
---------------------------------------------------------------------------


<!--
Rumble server query 0.2

Credits:
Mount (porting to rumble)
[XE]Tommis (testing)
Falcon (for the orginal script)

Changelog:

0.2 Added some tweaks
0.1 Release

--->
<?php

// server information
$ServerIP = "213.202.216.146"; // FILL HERE YOUR IP
$ServerPort = "22222"; // FILL HERE YOUR PORT
$display = "1"; // 1 = Default design 2 = Own design

##################### DO NOT EDIT BEYOND THIS POINT! #############################

$fp = fsockopen("udp://" . $ServerIP, $ServerPort + 123, $errno, $errstr);

function nick($nick) {
$nick=str_replace("<","<.",$nick);
return $nick;
}

// check if connection succeeded
if (!$fp) {
echo "$errstr ($errno)<br>\n";
exit;
} else {
// connection was established!

fputs ($fp, "s");
$c = '';
// get data..
do {
$c .= fread ($fp,1);
$fpstatus = socket_get_status($fp);
} while ($fpstatus["unread_bytes"] );
// close the connection; we don't really need it anymore
fclose ($fp);

$playerquery = strchr($c,"?");
$serverquery = substr($c,0, strlen($c) - strlen($playerquery));

$players = explode ("?",$playerquery);
unset($players[0]); // Remove Array number 0 because nothing is entered by explode.

// sort all data.
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace(" ","<=>",$serverquery);

for($i=0;$i<(count($serverquery));$i++){

$explodedata = explode("<=>",$serverquery);

}
}
// define some more variables
$string = "$ServerPort";
$stringlength = strlen($string);

$server_name_ip = $ServerPort;
$server_name_ip .= $explodedata[2][$stringlength];

$server_name = str_replace("$server_name_ip","",$explodedata[2]);
$server_name = explode("", $server_name);
$server_name = $server_name[0];

$max_players = explode("", $explodedata[7]);
$max_players = $max_players[0];

$gversion = explode("", $explodedata[4]);
$gversion = $gversion[0];

foreach (array_keys($players) as $player) { $players_in++; }; // get number of players in the server

foreach (array_keys($players) as $player) {
$pcount++;
$player = substr($players[$player],1,strlen($players[$player]) - 6);
$player = explode("0", $player);
$playersin[$pcount] = $player[0];
}

// *** START OUTPUTTING DATA ***//

if (!$serverquery) {
echo "Server offline";
} else {
// server is online and data was parsed
if ($display == '1')
{
echo "Servername: $server_name <BR>";
echo "Rumble Version: $gversion <BR>";
echo "Players: $players_in/$max_players <br>";
echo "Server IP: $ServerIP <BR>";
echo "Server Port: $ServerPort <BR>";

echo "<br>";
echo "<strong>Players:</strong><br />";

// Player List
$pcount = 0;
foreach (array_keys($players) as $player) {
$pcount++;
echo "$pcount "; // Player number
$player = substr($players[$player],1,strlen($players[$player]) - 6);
$player = explode("Neutral", $player);
echo nick($player[0]);
echo "<br>";
}
}
}
?>



Geschrieben von Gothmog am 16.04.2006 um 09:33:

  RE: php Serverinfo-Script Rumble 0.2a

Jup! Isses.

werd ich aber heute nicht zu kommen, da wir den ganzen Tag unterwegs sind. Ostersonntag halt.

Mfg Gothmog



Geschrieben von Gothmog am 16.04.2006 um 10:01:

  RE: php Serverinfo-Script Rumble 0.2a

Na hab doch noch mal 5 Minuten gehabt. Drin isses erstma. Feinheiten muessen ma spaeter machen. Hier nochma der Direktlink:

http://www.asg-funclan.de/modules.php?name=Content&pa=showpage&pid=31

Ansonsten wie gehabt ueber die Serverliste.

Mfg Gothmog



Geschrieben von Truesp!n am 16.04.2006 um 15:03:

 

Cool, danke. Kannst du folgendes irgendwo in klein mit unterbringen?

Credits:
Falcon (orginal script)
[XE]Tommis (testing)
Mount (porting to Rumble)

Btw sollte man das?


Forensoftware: Burning Board 2.3.6, entwickelt von WoltLab GmbH