SRCDS Steam group


Perl + server query = Help
#1
Hi!

Does anyone know how to find number of players on a game server? Is it possible to make a script that does this?

Thanks in advance
Reply
#2
From the server console? Over a website?
Reply
#3
From a website:
Php Class
(You obviously need php knowledge for that but I could help you)

From gameserver:
Take a look at mattie.info Smile
Q: What would an omnipotent computer to?
A: Get rid of humanity!
Reply
#4
Hi!

I was thinking from a game server. I'm just wondering how they manage to find the number since interaction between clients and server happens through UDP packets Smile

Thanks for the replies, i'll check it out Smile
Reply
#5
They do it on server side, the engine actually knows how many peeps there are (stores it in its internal memory-database)
Q: What would an omnipotent computer to?
A: Get rid of humanity!
Reply
#6
d4f Wrote:They do it on server side, the engine actually knows how many peeps there are (stores it in its internal memory-database)

Hi!

I see there is a source query protocol. Has anyone here used this with Perl? Or is there anyone with perl knowledge that can help me out? Smile
Reply
#7
Bump Toungue

I figured out how to retrieve the a2s_info packet respons the server sends back, but not how to get information like max players, server name etc from the packet. Can someone help me with this as I've spent countless of hours googeling and posting on other forums.

This is how it is done in PHP (below), but i have to do this in Perl.

PHP Code:
function getServerData() 
    { 
        
$this->writeData($this->getQuery("A2S_INFO")); 
        
        
$this->getData("byte"); 
        
$this->getString(); 
        
$this->serverData['hostname']   = $this->getString(); 
        
$this->serverData['map']        = $this->getString(); 
        
$this->getString(); 
        
$this->serverData['mod']        = $this->getString(); 
        
$this->serverData['players']    = $this->getData("byte"); 
        
$this->serverData['maxplayers'] = $this->getData("byte"); 
        
$this->getData("byte"); 
        
$this->serverData['servertype'] = (chr($this->getData("byte")) == "d") ? "Dedicated" "Listen"
        
$this->serverData['server_os']  = (chr($this->getData("byte")) == "w") ? "Windows" "Linux"
        
$this->serverData['password']       = $this->getData("byte"); 
        
$this->getData("byte"); 
        
$this->getString(); 
        
$this->getString(); 
        
$this->getString(); 
        
$this->getData("long"); 
        
$this->getData("long"); 
        
$this->getData("byte"); 
        
$this->getData("byte"); 
        
$this->serverData['vac']        = $this->getData("byte"); 
        
$this->getData("byte"); 
    } 
Reply
#8
I will try to forward a link off to LART next time I see him online.
~ Mooga ...w00t? - SRCDS.com on Twitter
[Image: 76561197965445574.png]
Please do not PM me for server related help
fqdn Wrote:if you've seen the any of the matrix movies, a game server is not all that different. it runs a version of the game that handles the entire world for each client connected. that's the 2 sentence explanation.
Reply
#9
Mooga Wrote:I will try to forward a link off to LART next time I see him online.

Hi!

Thanks! I appreciate you doing that! Wink

Edit: Problem solvedCool
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)