Author Topic: ASE query script  (Read 4680 times)

0 Members and 1 Guest are viewing this topic.

Offline Frenchie

  • Camper
  • ***
  • Posts: 358
  • SoldatHQ
ASE query script
« on: July 25, 2006, 07:14:58 pm »
Does anyone know of a PHP script that can query the soldat server's just like the ASE. I got the GSQuery firefox extension but it doesn't show player details correctly.

Anyone that knows of a script which could do this in PHP could you please post. Thanks
Soldat Lobby Avec Players -New Release! - Updated AGAIN!


Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: ASE query script
« Reply #1 on: July 25, 2006, 08:06:09 pm »
GSQuery is a PHP script...

http://www.terragate.net/gsQuery/docs/

Quote
gsQuery is a PHP library that allows you to query various game servers for things like number of players, the players itself, current map etc. The main goal of this class is to support as many games as possible. So some game specific thinks cannot be fetched with this class yet.

Offline Frenchie

  • Camper
  • ***
  • Posts: 358
  • SoldatHQ
Re: ASE query script
« Reply #2 on: July 25, 2006, 08:39:27 pm »
??  I'm not using that one the one i have is at http://rc.dotgeek.org/new/projects/project.php?project=gsquery

But thanks for the link
Soldat Lobby Avec Players -New Release! - Updated AGAIN!


Offline mar77a

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1295
  • mad
    • random stuffs
Re: ASE query script
« Reply #3 on: July 25, 2006, 09:47:42 pm »
Im pretty sure Demo (from Brazil) had a php script for this, let me check if i have copy.

Offline Frenchie

  • Camper
  • ***
  • Posts: 358
  • SoldatHQ
Re: ASE query script
« Reply #4 on: July 25, 2006, 10:42:53 pm »
That would be awesome mar77a.

I found one that works for a few games including soldat but players dont work.
http://www.tuts.net/~titulaer/rcon/webstatus.php
Soldat Lobby Avec Players -New Release! - Updated AGAIN!


Offline chrisgbk

  • Inactive Staff
  • Veteran
  • *****
  • Posts: 1739
Re: ASE query script
« Reply #5 on: July 26, 2006, 12:01:51 am »
That would be awesome mar77a.

I found one that works for a few games including soldat but players dont work.
http://www.tuts.net/~titulaer/rcon/webstatus.php

I had a look at that script; you should be able to hack it into working properly for players as it is (I haven't tried this yet) by changing the following in games/game_sld.inc.php:

              $player[$player_counter]['player'] = parse_ase ($result);
              $player[$player_counter]['team']   = parse_ase ($result);
              $player[$player_counter]['score']  = parse_ase ($result);
              $player[$player_counter]['ping']   = parse_ase ($result);

to:

              $player[$player_counter]['player'] = parse_ase ($result);
              $player[$player_counter]['team']   = parse_ase ($result);
              parse_ase ($result);
              $player[$player_counter]['score']  = parse_ase ($result);
              $player[$player_counter]['ping']   = parse_ase ($result);
              parse_ase ($result);

Note, that you can modify the entire script to support the missing values (Skin and Time, respectively) and assign appropriate values to the array, but that's an advanced topic.

The reason that most scripts can't handle soldat, is they don't properly implement the ASE protocol. The protocol includes a 6 bit bitmask (stored as a byte) that dictates what values are present for each player. Soldat currently uses all 6 of these fields, but most scripts don't bother to check the value of the bitmask; instead, they assume a fixed array of data(like this case, which assumes 4 pieces of data), which is incorrect.

Maybe EnEsCe can harrass game-monitor and get their script to work properly with soldat.
« Last Edit: July 26, 2006, 12:31:42 am by chrisgbk »

Offline Frenchie

  • Camper
  • ***
  • Posts: 358
  • SoldatHQ
Re: ASE query script
« Reply #6 on: July 26, 2006, 12:59:02 am »
Sweet!!,
thx chris the script is working perfectly
 ;D
Soldat Lobby Avec Players -New Release! - Updated AGAIN!


Offline chrisgbk

  • Inactive Staff
  • Veteran
  • *****
  • Posts: 1739
Re: ASE query script
« Reply #7 on: July 26, 2006, 02:11:35 am »
Sweet!!,
thx chris the script is working perfectly
 ;D

Good to hear. Now, feel like trying to see if I can make it work for all the values? replace this, in games/game_sld.inc.php:
Code: [Select]
    if ($PLAYER) {
        if (! empty ($result)) {
          $header = array (
                      'player' => array (
                                    'name'  => 'Player',
                                    'width' => '%-32s'
                                  ),

                      'team'   => array (
                                    'name'  => 'Team',
                                    'width' => '%-16s'
                                  ),

                      'score'  => array (
                                    'name'  => 'Score',
                                    'width' => '%3d'
                                  ),

                      'ping'   => array (
                                    'name'  => 'Ping',
                                    'width' => '%3d'
                                  )
                    );

          read_byte ($result);

          if (strlen ($result) > 0) {
            $player_counter = 0;

            while (strlen ($result) > 0) {
              $player_counter = $player_counter + 1;

              read_byte ($result);

              $player[$player_counter]['player'] = parse_ase ($result);
              $player[$player_counter]['team']   = parse_ase ($result);
              parse_ase ($result);
              $player[$player_counter]['score']  = parse_ase ($result);
              $player[$player_counter]['ping']   = parse_ase ($result);
              parse_ase ($result);
            };
          };
        };
      };

with this:
Code: [Select]
    if ($PLAYER) {
        if (! empty ($result)) {
          $header = array (
                      'player' => array (
                                    'name'  => 'Player',
                                    'width' => '%-32s'
                                  ),

                      'team'   => array (
                                    'name'  => 'Team',
                                    'width' => '%-16s'
                                  ),

                      'score'  => array (
                                    'name'  => 'Score',
                                    'width' => '%3d'
                                  ),

                      'ping'   => array (
                                    'name'  => 'Ping',
                                    'width' => '%3d'
                                  ),

                      'time'   => array (
                                    'name'  => 'Time',
                                    'width' => '%3d'
                                  )
                    );

          read_byte ($result);

          if (strlen ($result) > 0) {
            $player_counter = 0;

            while (strlen ($result) > 0) {
              $player_counter = $player_counter + 1;

              read_byte ($result);

              $player[$player_counter]['player'] = parse_ase ($result);
              $player[$player_counter]['team']   = parse_ase ($result);
              parse_ase ($result);
              $player[$player_counter]['score']  = parse_ase ($result);
              $player[$player_counter]['ping']   = parse_ase ($result);
              $player[$player_counter]['time']   = parse_ase ($result);
            };
          };
        };
      };

Note: I deliberately left out the Skin variable, since it is the same as Team currently so its redundant. If this actually works, it's easy enough to add in however, if needed for the future. The result of this change will be that how long players have been playing will show up.

Try it out, let me know if it worked or not.

Offline Frenchie

  • Camper
  • ***
  • Posts: 358
  • SoldatHQ
Re: ASE query script
« Reply #8 on: July 26, 2006, 02:39:19 am »
Wow,
thanks chris works perfect and better than game-monitor.
I soon want to have a script working similar to game-monitor but only for soldat servers.

I haved emailed the programmer asking him to update it according to your code.

Thanks again.
Soldat Lobby Avec Players -New Release! - Updated AGAIN!