The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I run a gameserver, and I have some php code that checks the server status. Here is the code if youd like to see it:
Code:
<?php # function: nwserver_status # Returns the server status in an array # If the server does not respond with the expected hex string, # it returns an error message (which is not an array). function nwserver_status($serveraddr, $port="5121", $timeout=5) { $connect = fsockopen( "udp://" . $serveraddr, $port, $errno, $errstr, $timeout ); $error = NULL; if ( ! $connect ) { $error = "server down"; return $error; } else { socket_set_timeout( $connect, $timeout ); $send = "\xFE\xFD\x00\xE0\xEB\x2D\x0E\x14\x01\x0B\x01\x05\x08\x0A\x33\x34\x35\x13\x04\x36\x37\x38\x39\x14\x3A\x3B\x3C\x3D\x00\x00"; fwrite( $connect, $send ); $output = fread( $connect, 5000 ); if ( ! $output ) { $error = "no reply"; } else { $statusarray = explode( "\x00", $output ); if (count($statusarray) < 6) { // if the array has < 6 elements, we're referencing a non-existing element $error = "bad reply"; } } } fclose( $connect ); if ($error == NULL) { return $statusarray; } else { return $error; } } # php script to get the server status and player list // gets server status directly from the gameserver $serveraddr = "xxx.xxx.xxx.xxx"; // $server_down is displayed if the script can't connect // or if it receives no data from the server $server_down = "<p class=\"highlight\">The server is down - now what are you gonna do?</p>\n"; $status = nwserver_status($serveraddr); if (!is_array($status)) { // if an error message was returned print ($status); } else { // format serverstatus array // $status[11] is the port used, $status[5] the number of players online // $status[6] the maximum number of players allowed print( "Server Address: <strong>$serveraddr:$status[11]</strong><br />\n" ); print( "Server Status: <strong>Online</strong><br />\n" ); print( "Players: <strong>$status[5]</strong> / <strong>$status[6]</strong><br />\n" ); } ?> I know it deals with making a plugin, but I dont know what to hook it off of for it to be there. In the end, Id like to have it fire off and give the feedback, essentially looking like this: Quote:
|
#2
|
||||
|
||||
![]()
<a href="http://www.vbulletin.com/docs/html/main/templates_externalfiles" target="_blank">http://www.vbulletin.com/docs/html/m..._externalfiles</a>
|
#3
|
|||
|
|||
![]()
Thanks tons my friend.
Worked like a charm. ![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|