ARGUM3NT

SA:MP Monitoring JS (From PHP)

Nov 17th, 2017
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2. /*
  3.    
  4.     Monitoring SA-MP Javascript
  5.             Argument 2017
  6.    
  7. */
  8.  
  9. include "SampQueryAPI.php";
  10. $query = new SampQueryAPI($_GET['ip'], intval($_GET['port']));
  11.  
  12. if ($query->isOnline()) {
  13.     $aInformation = $query->getInfo();
  14.     $aServerRules = $query->getRules();
  15.  
  16.     $server_inf = array(
  17.         "status" => 1,//online
  18.         //aInformation
  19.         "hostname" => htmlentities($aInformation['hostname'], ENT_QUOTES, 'cp1251'),
  20.         "gamemode" => htmlentities($aInformation['gamemode'], ENT_QUOTES, 'cp1251'),
  21.         "mapname" => htmlentities($aInformation['mapname'], ENT_QUOTES, 'cp1251'),
  22.         "players" => $aInformation['players'],
  23.         "maxplayers" => $aInformation['maxplayers'],
  24.         "password" => $aInformation['password'],
  25.         //aServerRules
  26.         "weather" => $aServerRules['weather'],
  27.         "worldtime" => $aServerRules['worldtime'],
  28.         "version" => $aServerRules['version'],
  29.         "weburl" => htmlentities($aServerRules['weburl'], ENT_QUOTES, 'cp1251')
  30.     );
  31. }
  32. else $server_inf = array("status" => 0); //offline
  33. ?>
  34. var samp = <?=json_encode($server_inf)?>;
Advertisement
Add Comment
Please, Sign In to add comment