Merhaba arkadaşlar bilen vardır belki lgsl adında bir live game server list scripti var ben serverimin verisini çekmek istiyorum ve çekiyorumda fakat çekilen veriler "Nick"-"Frag"-"Süre" şeklinde ben buna birde "Team" olayını çekmek istiyorum fakat bir türlü çekemedim yardımlarınızı bekliyorum.
lgsl_protocol.php
function lgsl_query_05(&$server, &$lgsl_need, &$lgsl_fp) { //---------------------------------------------------------+ // REFERENCE:http://developer.valvesoftware.com/wiki/Server_Queries if ($server['b']['type'] == "halflifewon") { if ($lgsl_need['s']) { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFdetails\x00"); } elseif ($lgsl_need['e']) { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFrules\x00"); } elseif ($lgsl_need['p']) { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFplayers\x00"); } } else { $challenge_code = isset($lgsl_need['challenge']) ? $lgsl_need['challenge'] : "\x00\x00\x00\x00"; if ($lgsl_need['s']) { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00"); } elseif ($lgsl_need['e']) { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFF\x56{$challenge_code}"); } elseif ($lgsl_need['p']) { fwrite($lgsl_fp, "\xFF\xFF\xFF\xFF\x55{$challenge_code}"); } } //---------------------------------------------------------+ // THE STANDARD HEADER POSITION REVEALS THE TYPE BUT IT MAY NOT ARRIVE FIRST // ONCE WE KNOW THE TYPE WE CAN FIND THE TOTAL NUMBER OF PACKETS EXPECTED $packet_temp = array(); $packet_type = 0; $packet_count = 0; $packet_total = 4; do { //$packet = fread($lgsl_fp, 4096); if (!$packet) { return FALSE; } if (!($packet = fread($lgsl_fp, 4096))) { if ($lgsl_need['s']) { return FALSE; } elseif ($lgsl_need['e']) { $lgsl_need['e'] = FALSE; return TRUE; } else { return TRUE; } } //---------------------------------------------------------------------------------------------------------------------------------+ // NEWER HL1 SERVERS REPLY TO A2S_INFO WITH 3 PACKETS ( HL1 FORMAT INFO, SOURCE FORMAT INFO, PLAYERS ) // THIS DISCARDS UN-EXPECTED PACKET FORMATS ON THE GO ( AS READING IN ADVANCE CAUSES TIMEOUT DELAYS FOR OTHER SERVER VERSIONS ) // ITS NOT PERFECT AS [s] CAN FLIP BETWEEN HL1 AND SOURCE FORMATS DEPENDING ON ARRIVAL ORDER ( MAYBE FIX WITH RETURN ON HL1 APPID ) if ($lgsl_need['s']) { if ($packet[4] == "D") { continue; } } elseif ($lgsl_need['e']) { if ($packet[4] == "m" || $packet[4] == "I" || $packet[4] == "D") { continue; } } elseif ($lgsl_need['p']) { if ($packet[4] == "m" || $packet[4] == "I") { continue; } } //---------------------------------------------------------------------------------------------------------------------------------+ if (substr($packet, 0, 5) == "\xFF\xFF\xFF\xFF\x41") { $lgsl_need['challenge'] = substr($packet, 5, 4); return TRUE; } // REPEAT WITH GIVEN CHALLENGE CODE elseif (substr($packet, 0, 4) == "\xFF\xFF\xFF\xFF") { $packet_total = 1; $packet_type = 1; } // SINGLE PACKET - HL1 OR HL2 elseif (substr($packet, 9, 4) == "\xFF\xFF\xFF\xFF") { $packet_total = ord($packet[8]) & 0xF; $packet_type = 2; } // MULTI PACKET - HL1 ( TOTAL IS LOWER NIBBLE OF BYTE ) elseif (substr($packet, 12, 4) == "\xFF\xFF\xFF\xFF") { $packet_total = ord($packet[8]); $packet_type = 3; } // MULTI PACKET - HL2 elseif (substr($packet, 18, 2) == "BZ") { $packet_total = ord($packet[8]); $packet_type = 4; } // BZIP PACKET - HL2 $packet_count ++; $packet_temp[] = $packet; } while ($packet && $packet_count < $packet_total); if ($packet_type == 0) { return $server['s'] ? TRUE : FALSE; } // UNKNOWN RESPONSE ( SOME SERVERS ONLY SEND [s] ) //---------------------------------------------------------+ // WITH THE TYPE WE CAN NOW SORT AND JOIN THE PACKETS IN THE CORRECT ORDER // REMOVING ANY EXTRA HEADERS IN THE PROCESS $buffer = array(); foreach ($packet_temp as $packet) { if ($packet_type == 1) { $packet_order = 0; } elseif ($packet_type == 2) { $packet_order = ord($packet[8]) >> 4; $packet = substr($packet, 9); } // ( INDEX IS UPPER NIBBLE OF BYTE ) elseif ($packet_type == 3) { $packet_order = ord($packet[9]); $packet = substr($packet, 12); } elseif ($packet_type == 4) { $packet_order = ord($packet[9]); $packet = substr($packet, 18); } $buffer[$packet_order] = $packet; } ksort($buffer); $buffer = implode("", $buffer); //---------------------------------------------------------+ // WITH THE PACKETS JOINED WE CAN NOW DECOMPRESS BZIP PACKETS // THEN REMOVE THE STANDARD HEADER AND CHECK ITS CORRECT if ($packet_type == 4) { if (!function_exists("bzdecompress")) // REQUIREShttp://php.net/bzip2 { $server['e']['bzip2'] = "unavailable"; $lgsl_need['e'] = FALSE; return TRUE; } $buffer = bzdecompress($buffer); } $header = lgsl_cut_byte($buffer, 4); if ($header != "\xFF\xFF\xFF\xFF") { return FALSE; } // SOMETHING WENT WRONG //---------------------------------------------------------+ $response_type = lgsl_cut_byte($buffer, 1); if ($response_type == "I") // SOURCE INFO ( HALF-LIFE 2 ) { lgsl_cut_byte($buffer, 1); $server['s']['name'] = lgsl_cut_string($buffer); $server['s']['map'] = lgsl_cut_string($buffer); $server['s']['game'] = lgsl_cut_string($buffer); $server['e']['description'] = lgsl_cut_string($buffer); $server['e']['appid'] = lgsl_unpack(lgsl_cut_byte($buffer, 2), "S"); $server['s']['players'] = ord(lgsl_cut_byte($buffer, 1)); $server['s']['playersmax'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['bots'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['dedicated'] = lgsl_cut_byte($buffer, 1); $server['e']['os'] = lgsl_cut_byte($buffer, 1); $server['s']['password'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['anticheat'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['version'] = lgsl_cut_string($buffer); } elseif ($response_type == "m") // HALF-LIFE 1 INFO { $server_ip = lgsl_cut_string($buffer); $server['s']['name'] = lgsl_cut_string($buffer); $server['s']['map'] = lgsl_cut_string($buffer); $server['s']['game'] = lgsl_cut_string($buffer); $server['e']['description'] = lgsl_cut_string($buffer); $server['s']['players'] = ord(lgsl_cut_byte($buffer, 1)); $server['s']['playersmax'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['netcode'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['dedicated'] = lgsl_cut_byte($buffer, 1); $server['e']['os'] = lgsl_cut_byte($buffer, 1); $server['s']['password'] = ord(lgsl_cut_byte($buffer, 1)); if (ord(lgsl_cut_byte($buffer, 1))) // MOD FIELDS ( OFF FOR SOME HALFLIFEWON-VALVE SERVERS ) { $server['e']['mod_url_info'] = lgsl_cut_string($buffer); $server['e']['mod_url_download'] = lgsl_cut_string($buffer); $buffer = substr($buffer, 1); $server['e']['mod_version'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l"); $server['e']['mod_size'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l"); $server['e']['mod_server_side'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['mod_custom_dll'] = ord(lgsl_cut_byte($buffer, 1)); } $server['e']['anticheat'] = ord(lgsl_cut_byte($buffer, 1)); $server['e']['bots'] = ord(lgsl_cut_byte($buffer, 1)); } elseif ($response_type == "D") // SOURCE AND HALF-LIFE 1 PLAYERS { $returned = ord(lgsl_cut_byte($buffer, 1)); $player_key = 0; while ($buffer) { $server['p'][$player_key]['pid'] = ord(lgsl_cut_byte($buffer, 1)); $server['p'][$player_key]['name'] = lgsl_cut_string($buffer); $server['p'][$player_key]['score'] = lgsl_unpack(lgsl_cut_byte($buffer, 4), "l"); $server['p'][$player_key]['time'] = lgsl_time(lgsl_unpack(lgsl_cut_byte($buffer, 4), "f"));
[size=3]/* Benim e[simage]https://store.donanimhaber.com/35/9e/3f/359e3fe05a2d21e37810cf71fb8f4de3.png[/simage]klediğim kod [color=#FF0000]$server['p'][$player_key]['team'] = lgsl_cut_byte($buffer, 4);[/color] */[/size]
$player_key ++; } } elseif ($response_type == "E") // SOURCE AND HALF-LIFE 1 RULES { $returned = lgsl_unpack(lgsl_cut_byte($buffer, 2), "S"); while ($buffer) { $item_key = strtolower(lgsl_cut_string($buffer)); $item_value = lgsl_cut_string($buffer); $server['e'][$item_key] = $item_value; } } //---------------------------------------------------------+ // IF ONLY [s] WAS REQUESTED THEN REMOVE INCOMPLETE [e] if ($lgsl_need['s'] && !$lgsl_need['e']) { $server['e'] = array(); } if ($lgsl_need['s']) { $lgsl_need['s'] = FALSE; } elseif ($lgsl_need['e']) { $lgsl_need['e'] = FALSE; } elseif ($lgsl_need['p']) { $lgsl_need['p'] = FALSE; } //---------------------------------------------------------+ return TRUE; }