How do I show the status of my game or voice server?

Post Reply
User avatar
Nick|NFo
Former staff
Former staff
Posts: 2252
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sun Mar 30, 2003 1:56 pm
Location: 127.0.0.1

How do I show the status of my game or voice server?

Post by Nick|NFo »

Simply add code like the following to any webpage:

Code: Select all

<iframe src="http://www.nfoservers.com/query/stat.pl?id=bf3sea01" width=400 height=600 frameborder=0></iframe>
Replace the value of "id" with your server's identifier (the one you chose when you ordered the server). That code there would produce this output.

You can also customize the output to match your site, because every part of the page the script generates can be controlled by a stylesheet. The default stylesheet is here -- you can right-click and select "Save As" to save it to your hard drive. After editing it, upload the file to your webspace. You can specify the customized stylesheet when you call our script by using the "style" parameter. For instance, if I were to create my own stylesheet named "white.css" and upload it to my webspace, I could use this in my webpage instead of what was given above:

Code: Select all

<iframe src="http://www.nfoservers.com/query/stat.pl?style=http://mysubdomain.nuclearfallout.net/white.css&id=chernobyl" width=400 height=600 frameborder=0></iframe>
In fact, I did copy default.css to a new file, white.css, and changed the background color to white, got rid of the server information block and player list heading, changed some colors, altered the spacing in the player table, and doubled the image size, all by editing that file. The resulting stylesheet is here and would give this output.

You can even get rid of everything but a couple of lines if you want, to fit just the essentials in a small spot on your site. For example, this, which uses my minimal.css stylesheet.

Advanced users may prefer to retrieve the status information via a script and embed it directly into their page, instead of bothering with frames. For example, this short Perl script would do that:

Code: Select all

#!/usr/bin/perl

use LWP::Simple;

print qq|
Content-type: text/html

<html>
<head>
<title>Example script with server status inclusion</title>
</head>
<body>
This is Chernobyl's server status:<p />
|;

getprint "http://www.nfoservers.com/".
"query/stat.pl?style=http://www.nfoservers.com".
"/query/white.css&id=chernobyl&no-body=1";

print "<p /><i>Copyright (c) 2003 Nuclearfallout Enterprises, Inc.</i>";
That script's output would look something like this.

You'll note that in the code fragment we used another parameter -- "no-body". A "1" for that parameter indicates to our query script that no <body> tag should be included in the page output, and it is needed because placing two body tags in one document can be unnecessary and problematic.

A PHP version of that script would look like this:

Code: Select all

<html>
<head>
<title>Example script with server status inclusion</title>
</head>
<body>
This is Chernobyl's server status:<p />

<?php

echo(implode("", file("http://www.nfoservers.com/".
"query/stat.pl?style=http://www.nfoservers.com".
"/query/white&id=chernobyl&no-body=1")));

?>

<p /><i>Copyright (c) 2003 Nuclearfallout Enterprises, Inc.</i>
</html>
And would give the same output.
-Nick
User avatar
Edge100x
Founder
Founder
Posts: 12945
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Voice (Ventrilo/Murmur) server querying

Post by Edge100x »

Querying a voice server works very similarly to the above, so the same directions (to use an iframe or script) will work.

The script name for the Ventrilo querying utility is http://www.nfoservers.com/query/vstat.pl and by default it uses http://www.nfoservers.com/query/vdefault.css as its template.

The script name for the Murmur/Mumble querying utility is http://www.nfoservers.com/query/mstat.pl and by default it uses http://www.nfoservers.com/query/mdefault.css as its template.

The script name for the TS3 querying utility is http://www.nfoservers.com/query/tstat.pl and by default it uses http://www.nfoservers.com/query/tdefault.css as its template.
User avatar
Edge100x
Founder
Founder
Posts: 12945
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: How do I show the status of my game or voice server?

Post by Edge100x »

We also have an image-based banner in beta: http://www.nfoservers.com/forums/viewto ... f=1&t=9124
Post Reply