06.12.2011, 18:35
Today I tryied to show the players of a server in a list with c#, but on 'c' and 'd' I'm receiving 0 data. This morning it was working, but it was showing only a half of the players. Are there new queries?
<?php $sIPAddr = $_GET['ip']; // IP address of the server $iPort = $_GET['port']; // Server port. $sPacket = ""; // Blank string for packet. $aIPAddr = explode('.', $sIPAddr); // Exploding the IP addr. $sPacket .= "SAMP"; // Telling the server it is a SA-MP packet. $sPacket .= chr($aIPAddr[0]); // $sPacket .= chr($aIPAddr[1]); // $sPacket .= chr($aIPAddr[2]); // $sPacket .= chr($aIPAddr[3]); // Sending off the server IP, $sPacket .= chr($iPort & 0xFF); // $sPacket .= chr($iPort >> 8 & 0xFF); // Sending off the server port. $sPacket .= 'i'; // The opcode that you want to send. // You can now send this to the server. /** * Let's connect now to the server. */ $rSocket = fsockopen('udp://'.$sIPAddr, $iPort, $iError, $sError, 2); // Create an active socket. fwrite($rSocket, $sPacket); // Send the packet to the server. echo fread($rSocket, 2048); // Get the output from the server fclose($rSocket); ?>