11
Brad
Re: Searching for a Counter-Strike server-module
  • 2004/4/29 18:40

  • Brad

  • Not too shy to talk

  • Posts: 150

  • Since: 2003/12/4


The file madquery.php is what I use to query HLServers, well, Counter-Strike servers anyway.

At the very least it can give you the information below plus, I think, more if you have RCON access to the server. I don't, so I don't know much about it.

Address of server (as reported by server)
Hostname of server
Current map
Mod name ('cstrike', 'tfc')
Mod description (CounterStrike)
Number of active players
Max number of players
Protocol version (46)
Server type (dedicated/listen)
Server OS (Windows/Linux)
if password-protected or public
if running a mod (cstrike) or halflife server
Mod's website
Mod's FTP server
Mod's version
Mod download size
if server-only
if custom
if VAC-Secure
Instantaneous ping
Array of Player data (ID, Name, Frags, Time)
Array of public server cvars (cvar_name => cvar_value)
Readable version information (includes rcon-extended information, if available)

12
Mithrandir
Re: Searching for a Counter-Strike server-module

I'm thinking something like this now:
class XXServer {
    var 
$ip;
    var 
$port;
    
//And game-specific variables, too

    
function XXServer($ip$port) {
        
$this->ip $ip;
        
$this->port $ip;
    }

    function 
query() {
        
//code to retrieve information from server ending with a call to $this->prepare2show();
    
}

    function 
prepare2show() {
        
//code to put the information into a name => value array for a foreach loop in the template to just output the variables one after another
    
}
}

That way, there could be an assignment to $xoopsTpl with simply a $thisserver->query(); call

Is that feasible?

13
Brad
Re: Searching for a Counter-Strike server-module
  • 2004/4/29 21:29

  • Brad

  • Not too shy to talk

  • Posts: 150

  • Since: 2003/12/4


It is feasible.

However, I question the presentation quality if you just output the variables in a loop without taking into account groupings of variables or server-specific information that can be presented above and beyond the standard presentation.

I also wonder if it might be better to have separate functions for the standard variables like getServerDescription, getPlayerCnt, getMapName, and etc..

Take all this with a grain of salt. It's spur of the moment thought, not in-depth thought.

14
Mithrandir
Re: Searching for a Counter-Strike server-module

If we can get some generic properties like description, mapname, serverip, serverport etc. then yes

The alternative is to make game-specific templates as well (also feasible)

15
Brad
Re: Searching for a Counter-Strike server-module
  • 2004/4/30 14:12

  • Brad

  • Not too shy to talk

  • Posts: 150

  • Since: 2003/12/4


I can't imagine that the information you get from each of the different game types will be so different from one another. Some might have more than others but I am willing to bet that they'll all contain a common subset. Beyond that, some will share a couple other attributes, and maybe one or two will have unique information (but then, is that information really needed if the other games didn't see fit to include it?).

One of the problems with game-specific templates is how to ensure they maintain the look and feel that you're module is trying to achieve. Do you have a design for the display of the game information already in mind? Do you happen to have a prototype?

The display logic could perhaps be something like (obviously fleshed out more)...

echo Server Type
echo Server Description
echo Current Map
echo Current/Total Players

(reverting to VFP programming constructs)

IF 
hasPlayerInfo
   
FOR EACH player IN playerGroup
      
player.Name
      
IF EXISTS(player.Time)
         ? 
player.Time
      
ENDIF
      IF 
EXISTS(player.Frags)
         ? 
player.Frags
      
ENDIF
   ENDFOR
ENDIF

Login

Who's Online

171 user(s) are online (112 user(s) are browsing Support Forums)


Members: 0


Guests: 171


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits