Jump to content

dodgeitorelse3

Members
  • Posts

    266
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by dodgeitorelse3

  1. it is for a game server tracker . I am trying to learn what some parts of it are as I wopuld like to make a server query for our communications server. I am not afraid to learn and am somewaht capable within php but not to this extent. I have searched and searched and thanks to you guys I have been given keywords to search for and as usual, you guys know what you are looking at and talking about. below is the function I am trying to learn from. Any pointers to tutorials or whatever are greatly appreciated. function lgsl_query_09(&$server, &$lgsl_need, &$lgsl_fp) { //---------------------------------------------------------+ // SERIOUS SAM 2 RETURNS ALL PLAYER NAMES AS "Unknown Player" SO SKIP OR CONVERT ANY PLAYER REQUESTS if ($server['b']['type'] == "serioussam2") { $lgsl_need['p'] = FALSE; if (!$lgsl_need['s'] && !$lgsl_need['e']) { $lgsl_need['s'] = TRUE; } } //---------------------------------------------------------+ if ($lgsl_need['s'] || $lgsl_need['e']) { $lgsl_need['s'] = FALSE; $lgsl_need['e'] = FALSE; fwrite($lgsl_fp, "\xFE\xFD\x00\x21\x21\x21\x21\xFF\x00\x00\x00"); $buffer = fread($lgsl_fp, 4096); $buffer = substr($buffer, 5, -2); // REMOVE HEADER AND FOOTER if (!$buffer) { return FALSE; } $item = explode("\x00", $buffer); foreach ($item as $item_key => $data_key) { if ($item_key % 2) { continue; } // SKIP EVEN KEYS $data_key = strtolower($data_key); $server['e'][$data_key] = $item[$item_key+1]; } if (isset($server['e']['hostname'])) { $server['s']['name'] = $server['e']['hostname']; } if (isset($server['e']['mapname'])) { $server['s']['map'] = $server['e']['mapname']; } if (isset($server['e']['numplayers'])) { $server['s']['players'] = $server['e']['numplayers']; } if (isset($server['e']['maxplayers'])) { $server['s']['playersmax'] = $server['e']['maxplayers']; } if (isset($server['e']['password'])) { $server['s']['password'] = $server['e']['password']; } if (!empty($server['e']['gamename'])) { $server['s']['game'] = $server['e']['gamename']; } // AARMY if (!empty($server['e']['gsgamename'])) { $server['s']['game'] = $server['e']['gsgamename']; } // FEAR if (!empty($server['e']['game_id'])) { $server['s']['game'] = $server['e']['game_id']; } // BFVIETNAM if ($server['b']['type'] == "arma" || $server['b']['type'] == "arma2") { $server['s']['map'] = $server['e']['mission']; } elseif ($server['b']['type'] == "vietcong2") { $server['e']['extinfo_autobalance'] = ord($server['e']['extinfo'][18]) == 2 ? "off" : "on"; // [ 13 = Vietnam and RPG Mode 19 1b 99 9b ] [ 22 23 = Mounted MG Limit ] // [ 27 = Idle Limit ] [ 18 = Auto Balance ] [ 55 = Chat and Blind Spectator 5a 5c da dc ] } } //---------------------------------------------------------+ elseif ($lgsl_need['p']) { $lgsl_need['p'] = FALSE; fwrite($lgsl_fp, "\xFE\xFD\x00\x21\x21\x21\x21\x00\xFF\x00\x00"); $buffer = fread($lgsl_fp, 4096); $buffer = substr($buffer, 7, -1); // REMOVE HEADER / PLAYER TOTAL / FOOTER if (!$buffer) { return FALSE; } if (strpos($buffer, "\x00\x00") === FALSE) { return TRUE; } // NO PLAYERS $buffer = explode("\x00\x00",$buffer, 2); // SPLIT FIELDS FROM ITEMS $buffer[0] = str_replace("_", "", $buffer[0]); // REMOVE UNDERSCORES FROM FIELDS $buffer[0] = str_replace("player", "name", $buffer[0]); // LGSL STANDARD $field_list = explode("\x00",$buffer[0]); // SPLIT UP FIELDS $item = explode("\x00",$buffer[1]); // SPLIT UP ITEMS $item_position = 0; $item_total = count($item); $player_key = 0; do { foreach ($field_list as $field) { $server['p'][$player_key][$field] = $item[$item_position]; $item_position ++; } $player_key ++; } while ($item_position < $item_total); } //---------------------------------------------------------+ return TRUE; } //------------------------------------------------------------------------------------------------------------+ //------------------------------------------------------------------------------------------------------------+
  2. thank you Barand, I will read up on this.
  3. I have been looking at some functions to try to learn how they work. In one of these I see \x79\x00\x00\x00\x00/\x79\x00\x00\x00\x01/\x79\x00\x00\x00\x02 what is the basic idea of what this does in general?
  4. we track america's army coop servers. In the tracker it shows the current map ( see trackers at http://chevys-place.game-server.cc/servertracker.php. All the data in the tracker is cached in our database. I want to place a link on each tracker that will show the last 5 maps that have been on each server. I want to do this via an include file but I am not sure how to go about storing a list of maps in database. I wil be using a separate db for this data as it will make it easier for me to keep an eye on all the stuff we have. What I need a point in the right direction is this. Say I created a new database for this and managed to store the first map in there. then the next map that is on tracker wiould look at database and say hey, there is only one so we will add a second, and so on till there are 5. then how to remove the first and add another at the 5th spot so that I have a valid list of 5 maps in order of being seen on server. Hope this makes sense. Would this need to be a cron job? As I said I have no code for this yet. I am just looking for input from skilled folks like you to point me in the right direction. I should also say that since the data is cached in database the only time cache is updated is when a user looks at tracker page. So really to keep an accurate count of the last 5 maps would it need to be a cron job?
  5. Hi all, we have a game tracker that tracks lots of data from several game servers. I want to be able to track the last five maps for these servers but I am not sure how to go about it. If any one has a suggestion or a tutorial for me to look at I would be greatly appreciative. I am not looking for someone to write code for me, I just want to be pointed in the right direction is all. At the moment I have no code for this part.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.