Afaik Srcds does not have a rcon-command showing the player's team.
However you could create a UDP-listener and use the remote-logging feature to receive all the logs to a daemonized script
which then keeps track of the player's team changes, etc.
Q: What would an omnipotent computer to?
A: Get rid of humanity!
12-05-2009, 11:15 PM (This post was last modified: 12-05-2009, 11:17 PM by _dp.)
Hm,
i thought about a way to send a query to the steam masterserver, it should be possible to get these information in theory.
The query itself is easy to manage, the protocol is listed here: http://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol
but there must be a second query to get the playerlist (the list you see when you open the server info window)
i know how to do that with php, but i'm not very experienced with the source engine itself...
Is there a way to reduce the query time? Like if a server is currently down or offline, it would show up as offline. Currently it takes like over 30 seconds to load the page because the servers are offline.
(08-22-2010, 10:14 PM)SaintGTR Wrote: Is there a way to reduce the query time? Like if a server is currently down or offline, it would show up as offline. Currently it takes like over 30 seconds to load the page because the servers are offline.
You should be able to set a timeout in the actual query. You can simply adjust it to your needs
(08-22-2010, 10:14 PM)SaintGTR Wrote: Is there a way to reduce the query time? Like if a server is currently down or offline, it would show up as offline. Currently it takes like over 30 seconds to load the page because the servers are offline.
(08-22-2010, 10:14 PM)SaintGTR Wrote: Is there a way to reduce the query time? Like if a server is currently down or offline, it would show up as offline. Currently it takes like over 30 seconds to load the page because the servers are offline.
Send the server with a "ping" packet before actually querying it to check if its online/offline, than continue querying as usual (just set it up in a simple if/else block), it's faster than a timeout.
06-04-2012, 08:50 AM (This post was last modified: 06-04-2012, 08:50 AM by Chemicstry.)
I've updated this script to remove those hacky things and added some more functionality. I had to invent php byte buffer as I couldn't find anything similar lol.
Anyway here it is:
Code:
class ByteBuffer
{
public $data = array(), $pointer;
function __construct($data)
{
$this->data = str_split($data);
$this->pointer = 0;
}
public function ReadByte()
{
return ord($this->data[$this->pointer++]);
}
public function ReadShort()
{
return (ord($this->data[$this->pointer++]) | (ord($this->data[$this->pointer++])<<8));
}
public function ReadInt()
{
return (ord($this->data[$this->pointer++]) | (ord($this->data[$this->pointer++])<<8) | (ord($this->data[$this->pointer++])<<16) | (ord($this->data[$this->pointer++])<<24));
}
public function ReadChar()
{
return $this->data[$this->pointer++];
}
public function ReadString()
{
$string = '';
while ($this->data[$this->pointer] != "\0")
{
$string .= $this->data[$this->pointer];
$this->pointer++;
}
$this->pointer++;
return $string;
}
}
09-13-2012, 08:06 AM (This post was last modified: 09-13-2012, 08:08 AM by LuxLOL.)
Can someone help me make a little php script for Counter-Strike: Global Offensive?
If the Counter-Strike: Global Offensive server is online the php script should show this ->
Server Status: Online (green text color)
Server IP: x.x.x.x:x
Server Name: xxx
Server Version: xxx
Game Mode: xxx
Corrent Map: xxx
Current Players: x / x
If the Counter-Strike: Global Offensive server is offline the php script should show this ->
Server Status: Offline (red text color)
Server IP: x.x.x.x:x
Yea, I can't get the Current Players and Max Players to show up properly. This is what I got to work, . But I don't have 37 players on or a max of 49 players. Its still in bytes.
Functions
PHP Code:
<?php // error_reporting(0);
/* SOURCE ENGINE QUERY FUNCTION, requires the server ip:port */
class ByteBuffer {
public $data = array(), $pointer;
function __construct($data)
{ $this->data = str_split($data); $this->pointer = 0;
}
public function ReadByte()
{
return ord($this->data[$this->pointer++]);
}
public function ReadShort()
{
return (ord($this->data[$this->pointer++]) | (ord($this->data[$this->pointer++])<<8));
}
public function ReadInt()
{
return (ord($this->data[$this->pointer++]) | (ord($this->data[$this->pointer++])<<8) | (ord($this->data[$this->pointer++])<<16) | (ord($this->data[$this->pointer++])<<24));
}
public function ReadChar()
{
return $this->data[$this->pointer++];
}
public function ReadString()
{ $string = '';
while ($this->data[$this->pointer] != "\0")
{ $string .= $this->data[$this->pointer]; $this->pointer++;
} $this->pointer++;
return $string;
}
}