Author Topic: Zitro-Stats Addon: ZitroStats-Query  (Read 7859 times)

0 Members and 1 Guest are viewing this topic.

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Zitro-Stats Addon: ZitroStats-Query
« on: August 06, 2006, 09:23:57 pm »
As of version 1.20061005 of Zitro-Stats this script is a default plugin that's packed togheter with the Zitro-Stats files. So just download the newest Zitro-Stats package. thx

Hi there :)

I'm running a Soldat server for about two weeks now, and a few days back I installed oLaf's wonderful Zitro-Stats script. I kinda missed live stats, so i could see who was playing on my server (I didn't want to lauch a gamebrowser/admintool each time I just wanted a quick look).

So I decided to make a simple/quick script to query a Soldat server (using Qstat) and display the results on the Zitro-Stats page.

This is how it looks like:

You can also view the a live version on my Zitro-Stats page.

The script works by injecting some javascript code (by adding this to the server info field) into the index page. The javascript uses a XMLHttpRequest to request the results of the query script. (Better known as AJAX.) The query php script executes the qstat exe in order to retrieve the server stats, and puts the result in a nice zitrostats-sytle-matching format. And Voil√ ! a nicely integrated server-info pallet on your Zitro-Stats page.

You can download the following rar package ZitroStats-Query-v0.01.rar (8.1KB).
A readme-file is located in the rar package, but also available on my webspace: readme.txt, this file includes some more information, requirements and installation instructions.

Comments are always welcome, also if you have problems installing the script, let me know so I can try to help you.


To-do/Feature list for v0.1
  • A easy installer (PHP based)
  • Drop Qstat and use gsQuery, so it's PHP-only and therefore hopefully easier to use
  • Better multiple server support (CSS fix)
  • Display teams (if available)
  • Link/button to refresh a server (without refreshing the whole page)

If you have a feature request, be sure to post it here. And maybe i can add it to the to-do list.
« Last Edit: December 05, 2006, 08:37:22 pm by Maff^ »
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Death

  • Major(1)
  • Posts: 12
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #1 on: August 07, 2006, 03:08:34 pm »
What is your sevrer?....

Offline FliesLikeABrick

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 6142
    • Ultimate 13 Soldat
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #2 on: August 07, 2006, 03:16:18 pm »
... the screenshot shows his server's name, IP, and port.  What else could you want?

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #3 on: August 07, 2006, 03:19:43 pm »
What is your sevrer?....
I'm not sure what you mean with that..

If you're asking me what the ip/port is of my Soldat server.. it's the one in the screenshot (130.89.164.52:23073).
If you're asking me what the web address of my Zitro-Stats page is.. http://bl-tyrone.student.utwente.nl/zitrostats/ (also in my post above)
If you're asking me what the web address of this 'project' is ... http://bl-tyrone.student.utwente.nl/zitrostats/ (see signature)

edit: I was a bit to slow

BTW, if someone is going to use this script, please let me know (here), as I'm curious if anybody is going to use this :)
« Last Edit: August 07, 2006, 03:25:07 pm by Maff^ »
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Death

  • Major(1)
  • Posts: 12
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #4 on: August 07, 2006, 08:40:07 pm »
I meant which one his server is and the ip and port didn't work but when I tried again it did.

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1010
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #5 on: August 08, 2006, 02:08:36 pm »
Nice addon but it won't work when my PC is off.

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #6 on: August 08, 2006, 02:39:29 pm »
How do you mean?
Is your PC running the Soldat server, and you have a other server as webhost? if so, the script should report 'Server seems to be offline.'

Please supply some more information, so I can understand the problem, and fix it.
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1010
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #7 on: August 08, 2006, 02:50:45 pm »
My servers are hosted by hosting companies in where I can't run Qstat. This must be run in my own PC which is not 24/7 open, my servers are always online though ;)

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #8 on: August 08, 2006, 05:23:37 pm »
Ok, I was afraid that was the case, I'm thinking of losing the qstat part by writing it's function completely in PHP (it's not to hard, but it takes some more time). Or maybe setting up a tunneling system (so my server does the Qstat part).

Also I'm thinking of making a install file, which would alter the ZitroStats files (so it's still easy to set up), and easy to maintain (trough the ZitroStats admin page).

Date Posted: August 08, 2006, 04:29:33 PM
I made a PHP-only (test) version ...
Download qsQuery.rar from my server, and extract it in your ZitroStats folder. You would have to re-edit the query.php file, as it is overwritten.
(Requirements: PHP Socket support & A provider that allows inbound/outbound UDP traffic)

I personally still prefer the Qstat version, as it seems to do it's job a bit quicker.

Please let me now how this works out for you (and a link with the result).
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1010
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #9 on: August 08, 2006, 11:49:51 pm »
What I should write to server section at zitr-stats ? There is no readme :)

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #10 on: August 09, 2006, 02:36:30 am »
Sorry, I forgot to mention it's exactly the same as the previous version, but here is updated version...

Place this code only in the first server info box:
Code: [Select]
<script src="AjaxRequest.js"></script>
<script>
function getQueryResult(objname, host, port)
{
var obj = document.getElementById(objname);
if (obj)
{
AjaxRequest.get(
{
'url':'query.php?adr='+host+':'+port
,'onSuccess':function(req){ obj.innerHTML = req.responseText; }
,'onError':function(req){ obj.innerHTML = 'Could not load the query script.<br /><a href="'+req.url+'" target="_blank">'+req.url+'</a><br />Make sure you placed the script in the right folder.'; }
  }
);
}
}
</script>

And this code in all of your server info boxes:
Code: [Select]
<div id="server1"></div>
<script>getQueryResult('server1', 'localhost', 20373);</script>
(You should change 'server1' for server 2 and server 3, and so on. Also change the 'localhost' part, and maybe the port number if necessary.
« Last Edit: August 16, 2006, 05:54:28 am by Maff^ »
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1010
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #11 on: August 09, 2006, 03:48:55 am »
Ehmm.... I did this and nothing shows there.

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #12 on: August 09, 2006, 07:43:43 am »
It should work for your "Full Real CTF" server (85.214.35.115:24274), add the server to the 'trusted' server list like this: $servers[] = '85.214.35.115:24274';¬  (or set $limitServers to false).

And add the lines to the first server infobox (after the existing code):
Code: [Select]
<div id="leoCTF"></div>
<script>getQueryResult('leoCTF', '85.214.35.115', 24274);</script>

I'm looking into why the 2 other servers won't return the info.. Do you have access to the soldat.ini 's ? If so, could post/PM them (delete the passwords :P)
« Last Edit: August 09, 2006, 07:49:31 am by Maff^ »
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1010
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #13 on: August 10, 2006, 07:04:58 am »
So, what's up with that ? Did you fix the bug ?

*Maff here, Maff there, where's Maff ?  :o :o
« Last Edit: August 11, 2006, 12:30:10 pm by Leo »

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #14 on: August 11, 2006, 03:41:48 pm »
Sorry, I was offline for a couple of days, painting my room and laying a laminate floor in it..

I did find what was cause the javascript bug, and fixt it in my post, I already changed the code in your zitrostats page :P. You need to and the new INF server adress to your $servers (as it has a new port). Anyway, contact me on IRC if you have some more trouble.
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1010
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #15 on: August 11, 2006, 04:21:17 pm »
Works perfect, thanks :)

Link: www.soldat-lra.net/status

Offline RaMBocL

  • Major(1)
  • Posts: 15
  • D:
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #16 on: August 16, 2006, 04:04:08 am »
thx! it's works but i get a bug when i want to put more than 1 server.... the servers erase or something like that... T_T


 ???

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #17 on: August 16, 2006, 06:00:06 am »
This is a known bug, sorry for that. I thought I changed the above code, but apparently I forgot (or something went wrong).

change this:
Code: [Select]
obj = document.getElementById(objname);into:
Code: [Select]
var obj = document.getElementById(objname);
And it should work fine ..
« Last Edit: August 16, 2006, 07:06:15 am by Maff^ »
Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)

Offline RaMBocL

  • Major(1)
  • Posts: 15
  • D:
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #18 on: August 16, 2006, 12:23:15 pm »
This is a known bug, sorry for that. I thought I changed the above code, but apparently I forgot (or something went wrong).

change this:
Code: [Select]
obj = document.getElementById(objname);into:
Code: [Select]
var obj = document.getElementById(objname);
And it should work fine ..


doesn't work T_T...  first I create server 1 then server 2 but server 2 overwrite server  1 o.o! so the sever control panel shows only server #2

Offline Maff^

  • Major(1)
  • Posts: 20
    • Personal page
Re: Zitro-Stats Addon: ZitroStats-Query
« Reply #19 on: August 16, 2006, 01:54:48 pm »
doesn't work T_T... first I create server 1 then server 2 but server 2 overwrite server 1 o.o! so the sever control panel shows only server #2
If you post a link to your zitrostats page i could take a look. With this info I don't know what's wrong.
Or you could contact me on IRC, else it takes forever, and a lot of posts here (like with Leo :P). You can find me on #hcl@quakenet, or contact me on MSN (I've updated my profile).

Live server info for Zitro-Stats: topic | brokenliquid.net/zitrostats/
Brokenliquid.net DM Serv (soldat://130.89.164.52:23073/) (1.4.2)
now playing: Jungle (2/32) next: Krab

sig updated on 06-10-2008 23:28:45 (GMT+1)