Well this isn't something made with BYOND but it is pretty cool. What it is, is an image that will tell people whether a game is online or offline.
You'll need...
A host that allows direct linking.
A host that allows PHP
A host for the game (that will host the game regularly).
Ok create these 3 files...
1on.gif
1off.gif
.htaccess
Add this to the .htaccess file...
AddType application/x-httpd-php .gif
Then make 1on.gif and 1off.gif an image that says something like the game is online/offline (1on is online, 1off is offline).
Ok once you've done that open a text editor (Notepad works well) and add this code.
<?php
$server_ip = 'hosts IP Address';
$debugging = false;
$sever_ports = array(
'Account' => 'Port',
);
while (list($name,$value) = each($sever_ports)) {
$description = trim($name);
$port = intval($value);
if (strlen($description)>0 and $port>0) {
$fp = @fsockopen(trim($server_ip), $port, $errnum, $errstr, 3);
if (!$fp or !is_resource($fp)) {
$online = false;
if ($debugging == true) {
echo "Error: [$server_ip] $description ($port) - $errstr ($errnum)
\r\n";
}
} else {
$online = true;
@fclose($fp);
}
if ($online == true) {
header('location: http://yourhost.com/1on.gif');
} else{
header('location: http://youthost.com/1off.gif');
}
}
}
?>
Ok now here are the things to change. Change the IP Address ($server_ip) to the ip of the host.
Change the port ($server_ports) to the port the game is being hosted on. You cann add multipul ports like so...
'Account1' => 'Port1', 'Account2' => 'Port2'
Just change the Port1 ETC. to the port number.
Finally change the header('location: http://yourhost.com/1on.gif'); to the location of the image(s).
Once you've done all that save the file as 'online.gif' then upload all the files into there own directory.
Once you've done that simply link to the image like you would a normal image and it will tell people whether the game is online or offline.
I know it's not very practical unless you have a host which is either permenant (What would be the point in doing this if the host was permenant?) or a host which hosts the game quite alot.
I'll probably make it so you can add multiple IP addresses as well (it'll take a bit of time to see if it actually works).
I'll upload everything in a .zip file with instructions and a demo once my host is working.
You can edit the code in anyway you want (but don't blame me if it doesn't work). You don't have to use it for BYOND games. You can use it for just about any online game (It works with Ragnarok Online, Player Worlds RPGs and a few other MMORPG's made from scratch it even works with 2 Player games (were one player connects to the other)).
Anyway, enjoy.
P.S. If this is in the wrong place you can move it.
Ok. Here is a demo...
http://free.eh-solutions.net/yuugi/on/online.gif
Here are all the files you need.(no instructions yet).
http://free.eh-solutions.net/yuugi/on/f.zip
All you have to do is change the details entered (look above) and it will work.
ID:189443
![]() Jul 23 2003, 2:50 pm (Edited on Jul 23 2003, 4:52 pm)
|
|
![]() Jul 29 2003, 10:36 pm
|
|
This little gem got pushed aside by more chatty posts over the past week. I wonder if Polaris allows PhP then I could run it myself :)
|