Madykevy Posted November 6, 2013 Report Share Posted November 6, 2013 Hello, How can i get the amount of online players in my dayz epoch server and echo it on my website? Link to comment Share on other sites More sharing options...
0 asremix Posted November 7, 2013 Report Share Posted November 7, 2013 You can use http://www.gametracker.com/. Link to comment Share on other sites More sharing options...
0 Martin Posted November 11, 2013 Report Share Posted November 11, 2013 You can also use GameQ PHP Library (search on github) Link to comment Share on other sites More sharing options...
0 DNightmare Posted November 14, 2013 Report Share Posted November 14, 2013 No clue where I snatched it from some time ago, but you can just use: <?php // Don't want direct calling of this file if(count(get_included_files()) == 1) exit("Go away!"); function strToHex($string) { $hex=''; for ($i=0; $i < strlen($string); $i++) { $hex .= dechex(ord($string[$i])); } return $hex; } function hexToStr($hex) { $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2) { $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string; } function computeUnsignedCRC32($str){ sscanf(crc32($str), "%u", $var); $var = dechex($var + 0); return $var; } function dec_to_hex($dec) { $sign = ""; // suppress errors $h = null; if( $dec < 0){ $sign = "-"; $dec = abs($dec); } $hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f' ); do { $h = $hex[($dec%16)] . $h; $dec /= 16; } while( $dec >= 1 ); return $sign . $h; } function get_checksum($cs) { $var = computeUnsignedCRC32($cs); //echo "crchex: ".$var."<br/>"; $x = ('0x'); $a = substr($var, 0, 2); $a = $x.$a; $b = substr($var, 2, 2); $b = $x.$b; $c = substr($var, 4, 2); $c = $x.$c; $d = substr($var, 6, 2); $d = $x.$d; return chr($d).chr($c).chr($b).chr($a); } function rcon($serverip,$serverport,$rconpassword,$cmd){ $passhead = chr(0xFF).chr(0x00); $head = chr(0x42).chr(0x45); $pass = $passhead.$rconpassword; $answer = ""; $checksum = get_checksum($pass); $loginmsg = $head.$checksum.$pass; $rcon = fsockopen("udp://".$serverip, $serverport, $errno, $errstr, 1); stream_set_timeout($rcon, 1); if (!$rcon) { echo "ERROR: $errno - $errstr<br />\n"; } else { fwrite($rcon, $loginmsg); $res = fread($rcon, 16); $cmdhead = chr(0xFF).chr(0x01).chr(0x00); //$cmd = "Players"; $cmd = $cmdhead.$cmd; $checksum = get_checksum($cmd); $cmdmsg = $head.$checksum.$cmd; $hlen = strlen($head.$checksum.chr(0xFF).chr(0x01)); fwrite($rcon, $cmdmsg); $answer = fread($rcon, 102400); if ( strToHex(substr($answer, 9, 1)) == "0"){ $count = strToHex(substr($answer, 10, 1)); //echo $count."<br/>"; for ($i = 0; $i < $count-1; $i++){ $answer .= fread($rcon, 102400); } } //echo strToHex(substr($answer, 0, 16))."<br/>"; //echo strToHex($answer)."<br/>"; //echo $answer."<br/>"; $cmd = "Exit"; $cmd = $cmdhead.$cmd; $checksum = get_checksum($cmd); $cmdmsg = $head.$checksum.$cmd; fwrite($rcon, $cmdmsg); } return $answer; } ?> Save it as rcon.php and then use it in your site like: include("rcon.php"); $reply = rcon('IP',PORT,'RCONPASS','COMMAND'); // For example // rcon('127.0.0.1', 2302, 'changeme', 'players'); print_r($reply); Before printing, be sure to filter the answers / format it etc.. but you can basicly do everything RCON can, that way.. verification-checks, playerlists, kicks/bans/restarts/younameit Cheers, DNightmare Link to comment Share on other sites More sharing options...
0 KoTaS Posted August 11, 2014 Report Share Posted August 11, 2014 How do you filter out just to show names and total online in column like this 1# Player Name 1 2# Player Name 2 3# Player Name 3 4# Player Name 4 5# Player Name 5 Online 5/40 as it is now i do get like this BE[Players on server: [#] [IP Address]:[Port] [Ping] [GUID] [Name] -------------------------------------------------- 0 127.0.0.1:2316 -1 932ba042360e6e49f67e7aa5def48b84(?) HC-BOT 1 7.83.35.122:2304 125 30aadc0fd8b69d6a09652704188057bd(?) Donavan (2 players in total) Link to comment Share on other sites More sharing options...
0 cen Posted August 11, 2014 Report Share Posted August 11, 2014 recommend not putting your rcon password out on the web :) Kar 1 Link to comment Share on other sites More sharing options...
0 KoTaS Posted August 11, 2014 Report Share Posted August 11, 2014 Did not posted password (Password will be behind .htaccess) , just like to know how is possible to make as posted above. Iam super noob in this PHP Language Link to comment Share on other sites More sharing options...
0 KoTaS Posted August 11, 2014 Report Share Posted August 11, 2014 So no one can help it out to figure on filtering RCON so it shows similar to this 1# Player Name 1 2# Player Name 2 3# Player Name 3 4# Player Name 4 5# Player Name 5 Online 5/40 Link to comment Share on other sites More sharing options...
0 Defent Posted August 11, 2014 Report Share Posted August 11, 2014 Look here: https://developer.valvesoftware.com/wiki/Source_Server_Queries https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol https://developer.valvesoftware.com/wiki/Server_Queries https://developer.valvesoftware.com/wiki/Source_RCON_Protocol Link to comment Share on other sites More sharing options...
0 KoTaS Posted August 11, 2014 Report Share Posted August 11, 2014 Interesting stuff, but this is general usage of RCON and all HEX Codes Link to comment Share on other sites More sharing options...
0 KoTaS Posted September 1, 2014 Report Share Posted September 1, 2014 So nobody have any PHP Scripting skills? This is very help full not just for me, all this RCON Stuff Link to comment Share on other sites More sharing options...
0 KoTaS Posted September 16, 2014 Report Share Posted September 16, 2014 Achieved what i was looking for. Now using Rcon to show who and how many online -- test it out on www.kotas.tk Link to comment Share on other sites More sharing options...
0 Sandbird Posted November 8, 2014 Report Share Posted November 8, 2014 bump, is this still working ? cause its not working for me....has anything changed since September ? I have fsockets on in my php.ini....but i just get a white page. There used to be a script (if i remember correctly) that didnt require the rcon pass to show the players. Was it based on Gamespy responds ? cant remember. Link to comment Share on other sites More sharing options...
Question
Madykevy
Hello,
How can i get the amount of online players in my dayz epoch server and echo it on my website?
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now