Posts: 36
	Threads: 3
	Joined: Aug 2009
	
Reputation: 
0
	 
 
	
	
		
Code:
function source_query_old($ip,$port)
{
    $timeout = "1000000";
    $HL2_address = $ip;
    $HL2_port = $port;
    $HL2_command = "\377\377\377\377TSource Engine Query\0";
    $HL2_socket = fsockopen("udp://" . $HL2_address, $HL2_port, $errno, $errstr, 3);
    fwrite($HL2_socket, $HL2_command);
    socket_set_timeout($HL2_socket,0,$timeout);
    $JunkHead = fread($HL2_socket, 4);
    $CheckStatus = socket_get_status($HL2_socket);
        
    if ($CheckStatus["unread_bytes"] == 0)
        return "socket not made";
    if ($CheckStatus['timed_out'] == 1) {
        return "timeout";
    }
    
    $do = 1;
    while ($do) {
        $str = fread($HL2_socket, 1);
        $HL2_stats .= $str;
        $status = socket_get_status($HL2_socket);
        if ($status["unread_bytes"] == 4) {
            $do = 0;
        }
    }
      fclose($HL2_socket);
    $x = 0;
    while ($x <= strlen($HL2_stats)) {
        $x++;
        $result .= substr($HL2_stats, $x, 1);
    }
   
    $result = str_split($result);
    $char = 15;
    while (ord($result[$char]) != "%00") {
        $info['name'] .= $result[$char];
        $char++;
    }
    $char++;
    while (ord($result[$char]) != "%00") {
        $info['name'] .= $result[$char];
        $char++;
    }
    $char++;
    while (ord($result[$char]) != "%00") {
        $info['map'] .= $result[$char];
        $char++;
    }
    $char++;
    while (ord($result[$char]) != "%00") {
        $info['description'] .= $result[$char];
        $char++;
    }
    $char++;
    while (ord($result[$char]) != "%00") {
        $info['host'] .= $result[$char];
        $char++;
    }
    $char ++;
    $info['players'] = ord($result[$char]);
    $char ++;
    $info['max'] = ord($result[$char]);
    $char++;    
    $info['bots'] = ord($result[$char]);
    
    $char++;
    $info['dedicated'] = ord($result[$char]);
    $char++;
    $info['os'] = chr(ord($result[$char]));
    $char++;
    $info['password'] = ord($result[$char]);
    $char++;
    $info['secure'] = ord($result[$char]);
    $char++;
    return $info;
}
 
Try this i changed it to the values i saw going thought Wireshark to a 1.6 server, bot count dose not work atm 
	
 
	
	
Need help? Join my Teamspeak 203.98.81.94:9987