Pecetowicz

Kod PHP na baner graficzny pod CS:GO

May 7th, 2024 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.67 KB | None | 0 0
  1. <?php
  2. # Skrypt, sprawdzający status serwera
  3. # Skrypt wykonał: SiteFuture - sitefuture - Strona główna | Facebook
  4.  
  5. # Pobieranie konfiguracji
  6. require_once 'include/GameQ.php';
  7. # Czcionka
  8. define('Rajdhani',    'assets/fonts/Rajdhani-Regular.ttf');
  9.  
  10. $ip = $_GET['ip'];
  11.  
  12.  
  13. if (isset($ip) && !empty($ip)) {
  14.  
  15.     $server = array(
  16.                                 'type' => 'csgo',
  17.                                 'host' => $ip
  18.                             );
  19.  
  20.                             $gq = new GameQ();
  21.                             $gq->setOption('timeout', 5);
  22.                             $gq->setOption('debug', TRUE);
  23.                             $gq->setFilter('normalise');
  24.                             $gq->addServer($server);
  25.  
  26.                             $results = $gq->requestData();
  27.                             $online = $results[$ip]['gq_online'];
  28.                             
  29.  
  30.     if($online !="1") 
  31.     {
  32.         $hostname = 'Serwer '.$ip.' jest OFFLINE';
  33.         $players = "x";
  34.         $playersmax = "x";
  35.         $map = "OFFLINE";
  36.     } 
  37.     else 
  38.     {
  39.         $hostname= $results[$ip]['gq_hostname'];
  40.         $playersmax = $results[$ip]['gq_maxplayers'];
  41.         $players = $results[$ip]['gq_numplayers'];
  42.         $map = $results[$ip]['gq_mapname'];
  43.     }
  44.     $znaki = strlen($hostname);
  45.     if($znaki < 45){
  46.  
  47.         $tekst = $hostname;
  48.     }
  49.         else{
  50.             $liczba = 45 - $test2;
  51.             $nazwa = substr($hostname, 0, $liczba);
  52.             $tekst = ''.$nazwa.'...';
  53.                     
  54.             }
  55.     
  56.  
  57.     $im = imagecreatefrompng("assets/images/mirage.png");
  58.  
  59.     $white = imagecolorallocate($im, 255, 255, 255);
  60.  
  61.     $info = $ip ."   ". $players ." / ". $playersmax ."   ". $map;
  62.  
  63.     imagettftext($im, 13, 0, 28, 93, $white, Rajdhani);
  64.  
  65.     imagettftext($im, 13, 0, 28, 118, $white, Rajdhani, $info);
  66.     
  67. } else {
  68.     $im = imagecreatefrompng("obrazy/cs.png");
  69.     $white = imagecolorallocate($im, 255, 255, 255);
  70.     $info = "123.456:27015     31 / 32     de_inferno";
  71.     imagettftext($im, 7, 0, 10, 15, $white, Rajdhani, "AceGo.pl [Only Mirage]");
  72.     imagettftext($im, 7, 0, 10, 30, $white, Rajdhani, $info);
  73. }
  74.  
  75.  
  76. header('Content-type: image/png');
  77. imagepng($im);
  78. imagedestroy($im); 
  79. ?>
Advertisement
Add Comment
Please, Sign In to add comment