Posts: 3
Threads: 1
Joined: May 2011
Reputation:
0
05-21-2011, 12:35 PM
(This post was last modified: 05-21-2011, 01:06 PM by mj_l.)
I read ' PHP stuff for game servers ' !
That’s marvelous !
But I want use by Counter-Strike 1.6 ,How to change code ?
Posts: 1,321
Threads: 85
Joined: Feb 2008
Reputation:
11
Should work exactly the same
~ trewq
Posts: 3
Threads: 1
Joined: May 2011
Reputation:
0
05-21-2011, 05:43 PM
(This post was last modified: 05-21-2011, 06:06 PM by mj_l.)
(05-21-2011, 04:19 PM)Goilio Wrote: Should work exactly the same 
No , Can't query 'players'、'playersmax'、'vac'、'password' ... more .
Look :
CS:S [normal]
![[Image: css2.gif]](http://sleekupload.com/uploads/5/css2.gif)
cs:s code:
CS1.6 [not good]
![[Image: cs2_1.gif]](http://sleekupload.com/uploads/5/cs2_1.gif)
cs1.6 code:
Can u fixed it ?
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
Posts: 3
Threads: 1
Joined: May 2011
Reputation:
0
11-19-2011, 11:43 AM
(This post was last modified: 11-19-2011, 11:43 AM by mj_l.)
(05-22-2011, 05:38 PM)MIG Wrote:
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
Nice , but can you make Compatible with both to One file ? (New and Old)
|