Who's online plugin

Post here if you need help setting up your server, etc.
User avatar
trevor
Average Program
Posts: 52
Joined: Fri Nov 23, 2012 8:45 am
Location: The Internet
Contact:

Who's online plugin

Post by trevor »

One of the players on my server just asked if there was a way he could look to see if anyone was online before opening the client and connecting to the server. Currently, I don't have anything like this but it sounds similar to the server listing that is on armagetronad.org. Is there any plugin like that one that can be set up to only check on my server?
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Who's online plugin

Post by Light »

If you have a webserver running on the server of the arma server (so many "server"'s in one sentence ..), you could check the players.txt with PHP.

Example: http://lightron.no-ip.org/Servers

The server names are gotten separate from the server_info.cfg though, and parsed to display colors rather than 0xXXXXXX.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Who's online plugin

Post by LOVER$BOY »

trevor wrote:One of the players on my server just asked if there was a way he could look to see if anyone was online before opening the client and connecting to the server. Currently, I don't have anything like this but it sounds similar to the server listing that is on armagetronad.org. Is there any plugin like that one that can be set up to only check on my server?
Nope, can't get that to work in the client. Need to manually go check website and do that.

Well you probably are looking for something like this: dlh's server browser.

It's like a server browser but works from a website, similar to what the game client does. Lists all the servers online and also shows who is in them and more.
Image
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Who's online plugin

Post by Light »

LOVER$BOY wrote:
trevor wrote:One of the players on my server just asked if there was a way he could look to see if anyone was online before opening the client and connecting to the server. Currently, I don't have anything like this but it sounds similar to the server listing that is on armagetronad.org. Is there any plugin like that one that can be set up to only check on my server?
Nope, can't get that to work in the client. Need to manually go check website and do that.

Well you probably are looking for something like this: dlh's server browser.

It's like a server browser but works from a website, similar to what the game client does. Lists all the servers online and also shows who is in them and more.
You could use a PHP script and check them from within the game with a custom command.
User avatar
trevor
Average Program
Posts: 52
Joined: Fri Nov 23, 2012 8:45 am
Location: The Internet
Contact:

Re: Who's online plugin

Post by trevor »

And what if the website is on a different server than the game? Will php still work working I make that file public? Can it retrieve files from another webserver since I have the game server running apache, there's just no DNS entry and I decided to go with 000webhost for the site instead of trying to get all the DNS and apache stuff set up. I'm still willing to do that, I was just trying to save time after getting the server running properly took enough time as it was. (LOVER$BOY can attest to that). I would probably need the source for that script though as as I have never touched pho before. (Just python, basic stuff at that.)
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Who's online plugin

Post by Light »

trevor wrote:And what if the website is on a different server than the game? Will php still work working I make that file public? Can it retrieve files from another webserver since I have the game server running apache, there's just no DNS entry and I decided to go with 000webhost for the site instead of trying to get all the DNS and apache stuff set up. I'm still willing to do that, I was just trying to save time after getting the server running properly took enough time as it was. (LOVER$BOY can attest to that). I would probably need the source for that script though as as I have never touched pho before. (Just python, basic stuff at that.)
He provided a link to where you can get the script for your site. You need to download bazaar (probably packaged as bzr) and checkout with the command given on that page. It will work out of the box as a server browser on your site.

If you wanted it just for your server(s), you'll need to make slight changes, but I'm pretty sure it's set up to handle that as well.

If you wanted it from inside the server, do you have more than one server on there? It would only work inside your servers, so checking the status of the server your in would be kind'a pointless. If you have multiple servers, you could parse the files I said about above.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Who's online plugin

Post by LOVER$BOY »

The php script can still work if you get the shortcut links working in your windows version. In linux it is easier to hard link them to the .../www/ directory.

... I'm not clearly sure how to explain this in the forums as this is more on the trevor uses windows...

BZR for Windows
Simply download the bzr and install it. Then you go into Bzr Explorer and choose "Get project source from elsewhere" and choose "Branch". A window should appear. In the "From:" box, enter the following.

Code: Select all

lp:~dlh/armagetronad/server-browser
For "To:", choose the folder you want the source to be saved in and click "Ok".

if you get the message "The destination is outside a shared repository. Would you like to initialise it now? This is generally recommended, click "Yes" and when a new window opens up, click "Ok" again. After done, hit "Close" and click "Ok" in the main window once more.

Once it's finished downloading the source, go to that folder and the source files should be in there! If not, you can always try again.

Useful Info about 000WebHost
Quote: chanh|Administrator
just a reminder gaming script on 000webhost is not allowed.

Quote: lobrc|Administrator
When we say gaming scripts we mean scripts that are hosted on out servers which are purely for pleasure/enjoyment. The reason we don't allow these is because they use a lot of server resources.

OH well...
So, from that I don't think it is possible for this script to work in 000WebHost.
Image
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Who's online plugin

Post by Light »

LOVER$BOY wrote: So, from that I don't think it is possible for this script to work in 000WebHost.
They probably don't allow the use of fsockopen() anyways. I think he would be better off just parsing his files though and host it on his own webserver. It's very easy to set up Apache, and if his server is on Windows, I think that LAMP would work out of the box.
User avatar
trevor
Average Program
Posts: 52
Joined: Fri Nov 23, 2012 8:45 am
Location: The Internet
Contact:

Re: Who's online plugin

Post by trevor »

000WebHost doesn't allow gaming servers as in the actual server binary that runs on the machine the client connects to. They are fine with hosting websites for game servers as long as the game itself is hosted elsewhere, the map repository for my server has been hosted on that domain ever since I added a rotation.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Who's online plugin

Post by LOVER$BOY »

Light wrote:
LOVER$BOY wrote: So, from that I don't think it is possible for this script to work in 000WebHost.
They probably don't allow the use of fsockopen() anyways. I think he would be better off just parsing his files though and host it on his own webserver. It's very easy to set up Apache, and if his server is on Windows, I think that LAMP would work out of the box.
Your right. Getting it working in windows was though until I found the use of Easy PHP. It's quite useful and easy to configure. Plus it has some amazing features to boot! Regular updates on the php version and components. Been using it for over a year and so far I got no complaints except that I don't used it to host my websites myself.
trevor wrote:000WebHost doesn't allow gaming servers as in the actual server binary that runs on the machine the client connects to. They are fine with hosting websites for game servers as long as the game itself is hosted elsewhere, the map repository for my server has been hosted on that domain ever since I added a rotation.
Even so, I know for a fact dlh's server browser script will not work as I just tested it an hour ago. It's located here.
Image
User avatar
trevor
Average Program
Posts: 52
Joined: Fri Nov 23, 2012 8:45 am
Location: The Internet
Contact:

Re: Who's online plugin

Post by trevor »

What about the php route of just displaying the text file like light first suggested? I just need to know what the command is for php to fetch the file from a remote server instead of a local file. I tried

Code: Select all

<?php include("my server's ip/players.txt") ?>
With the apache root directory set to my armagetronad/var folder but got no output.
User avatar
LOVER$BOY
Match Winner
Posts: 731
Joined: Thu Jan 24, 2008 12:46 pm

Re: Who's online plugin

Post by LOVER$BOY »

Code: Select all

<?php
include file.php;
?>
only works with including php files, not for txt files :P

Well, you can pull the stuff from your ip root folder and then get it to the server as a up-to-date running script. :)

Doesn't need to be compied and pasted. Even a shortcut should do (I think).

That "players.txt" file in the .../var/ directory only updates every round and that's not exactly what your looking for, right?

Do you want me to write you up a script for that AND do a little bit of modification in the alpha project builds so that players.txt will always remain up-to-date.
Image
User avatar
trevor
Average Program
Posts: 52
Joined: Fri Nov 23, 2012 8:45 am
Location: The Internet
Contact:

Re: Who's online plugin

Post by trevor »

Well, this script is just so people can go to the site and see if anyone is playing before they start up the client and connect. Updating every round should be enough for that purpose unless they happen to check right before the one playing leaves regrettable for the offer though. As for the script, that would be great, thanks.
Last edited by trevor on Tue Feb 05, 2013 6:36 am, edited 1 time in total.
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Who's online plugin

Post by Light »

You can [ic]include("/var/games/armagetronad/var/players.txt");[/ic] or wherever it's located. I think it's something like that. Make sure you use utf8_encode() and wrap it in PRE tags so it shows correctly.

If you want it to be completely live, I could write ya a script for that too, but it's not really worth the effort. The players file gives you a general idea of what's going on. Let me know.
User avatar
trevor
Average Program
Posts: 52
Joined: Fri Nov 23, 2012 8:45 am
Location: The Internet
Contact:

Re: Who's online plugin

Post by trevor »

Ok, could you explain pre tags? Tonight is my first time working with php. Other than that line of code I have I My post, what do I need?
Post Reply