SRCDS Steam group


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hi Need a php code to get server password sv_password = ?
#1
Hello!
I tried to write code that connects to the server and get in socket the server password
But without successSmile
Does anyone have an idea how to help me?
Reply
#2
So you want to get the current sv_password?
Reply
#3
yes if there is ...
if not so write "No Password"
Reply
#4
This should do it.
PHP Code:
function query_source($address)
  {
    
$array explode(":"$address);

    
$server['status'] = 0;
    
$server['ip']     = $array[0];
    
$server['port']   = $array[1];

    if (!
$server['ip'] || !$server['port']) { exit("EMPTY OR INVALID ADDRESS"); }

    
$socket = @fsockopen("udp://{$server['ip']}"$server['port'], $errno$errstr1);

    if (!
$socket) { return $server; }

    
stream_set_timeout($socket1);
    
stream_set_blocking($socketTRUE);
    
fwrite($socket"\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");
    
$packet fread($socket4096);
    @
fclose($socket);

    if (!
$packet) { return $server; }

    
$header                substr($packet04);
    
$response_type         substr($packet41);
    
$network_version       ord(substr($packet51));

    if (
$response_type != "I") { exit("NOT A SOURCE SERVER"); }

    
$packet_array          explode("\x00"substr($packet6), 5);
    
$server['name']        = $packet_array[0];
    
$server['map']         = $packet_array[1];
    
$server['game']        = $packet_array[2];
    
$server['description'] = $packet_array[3];
    
$packet                $packet_array[4];
    
$app_id                array_pop(unpack("S"substr($packet02)));
    
$server['players']     = ord(substr($packet21));
    
$server['playersmax']  = ord(substr($packet31));
    
$server['bots']        = ord(substr($packet41));
    
$server['status']      = 1;
    
$server['dedicated']   =     substr($packet51); 
    
$server['os']          =     substr($packet61); 
    
$server['password']    = ord(substr($packet71)); 
    
$server['vac']         = ord(substr($packet81)); 

    return 
$server;
  }
$query query_source("127.0.0.1:27015");
echo 
$query['game']; 
Reply
#5
This just show me if server have a password or not
I need to get the specific password...
Reply
#6
The server wont hand you the sv_password unless you have the rcon password.
Looking for a game server? Visit fullfrag.com and pick one up as low as $2.50 / mo!
Reply
#7
(06-19-2010, 03:29 AM)Alonn Wrote:  This just show me if server have a password or not
I need to get the specific password...

You can't without RCon password xD
Reply
#8
I have the rcon pass its not problem Smile
I thought about sending a command to the server via rcon sv_password
Then if you get "" So there's a no password, if he gets "sv_password" is "123" then put him in a variable $ password = 123
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)