1. Hi Guys,
    I need help with server status for rust server. I want php server status which will write hostname, ip, players/max_players and world settings (size and seed). But I only found script for players who not working.
    CODE:
    source: GitHub - xPaw/PHP-Source-Query: PHP library to query servers that implement Source Engine Query protocol
    Code:
    <?php
        header("Refresh:60");    require __DIR__ . 'SourceQuery/bootstrap.php';
        use xPaw\SourceQuery\SourceQuery;    define( 'SQ_SERVER_ADDR', 'rust.royalportal.eu' );
        define( 'SQ_SERVER_PORT', 28016 );
      define( 'SQ_TIMEOUT',     3 );
      define( 'SQ_ENGINE',      SourceQuery::SOURCE );  $Query = new SourceQuery( );
      try{
        $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE );
        $info = $Query->GetInfo( );
      }
      catch( Exception $e ){
        echo $e->getMessage( );
      }
      finally{
          $Query->Disconnect( );
      }  $cur_players = $info["Players"];
      $max_players = $info["MaxPlayers"];
    ?>
    <table>
    <tr>
      <td>Hra</td> <td>Názov servera</td> <td>IP Adresa</td> <td>Sloty</td> <td>Mapa</td> <td>VIP</td>
    </tr>
    <tr>
      <td><img src="img/ts3.png"></td>
      <td>RoyalPortal.eu | Teamspeak3</td>
      <td><code>ts.royalportal.eu</code></td>
      <td>50</td>
      <td>- - -</td>
      <td><a href="http://vip.royalportal.eu/ts"><span class="vip">VIP</span></a></td>
    </tr>
    <tr>
      <td><img src="img/rust.png"></td>
      <td>RoyalPortal.eu | Vanilla Wiped 28.7 15:10</td>
      <td><code>rust.royalportal.eu</code></td>
      <td><?php printf('%u/%u', $cur_players, $max_players); ?></td>
      <td>3000/9578</td>
      <td><a href="http://vip.royalportal.eu/rust/vanilla"><span class="donate">DONATE</span></a></td>
    </tr>
    </table>
    
    Sorry for my english
     
  2. The actual version of xPaw is outdated
     
  3. Do you have some new script for server status ?
     
  4. I'll try to upload asap
    I'm not at home right now
     
  5. GitHub - sami37/SourceQuery

    How to use:

    First, you need RustIO dll if you want ranking and connected players.

    Base code exemple :

    Code:
    require __DIR__ . '/../api/SourceQuery/bootstrap.php';
    use xPaw\SourceQuery\SourceQuery;define( 'SQ_SERVER_ADDR', 'YOUR_IP_HERE' );
    define( 'SQ_SERVER_PORT', YOUR_SERVER_PORT); // udp
    define( 'SQ_RCON_PORT', YOUR_RCON_PORT); // tcp - only for SourceQuery::SOURCE
    define( 'SQ_TIMEOUT',     2 );
    define( 'SQ_ENGINE',      SourceQuery::SOURCE );$Rules = 'Your Server description\nAnd more detail here';$Query = new SourceQuery( );
    try
    {
        $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_RCON_PORT, SQ_TIMEOUT, SQ_ENGINE );
        $Informations = $Query->GetInfo( );
        require_once __DIR__ . '/../api/RustIO/apikey.php';
        $connected = $Query->GetConnected($Rustapikey);
        $Query->Disconnect( );
    }
    catch( Exception $e )
    {
        echo $e->getMessage( );
    }echo (($connected) ? count(json_decode($connected)) : 0).'/'.(($Informations['MaxPlayers']) ? $Informations['MaxPlayers'] : 0);
    The following code will give you something like that if you have a great css file
    1501359202.png
    Code:
    <div class="slidetit" style="left:0px;width:100%;">
        <center>
            <div class="slidetitle" style="float:none;">
                <h4><?php echo (isset($Informations['HostName']) ? $Informations['HostName'] : 'RustEvolution');?></h4>
            </div>
            <h4><?php echo (isset($Informations['Map']) ? $Informations['Map'] : 0).' - '.(isset($Informations['Players']) ? $Informations['Players'] : 0).'/'.(isset($Informations['MaxPlayers']) ? $Informations['MaxPlayers'] : 0);?></h4>
        </center>
        <div class="serv_popup_content">
            <p>
                <p>
                    <?php
                        $rule = str_replace('\n', '<br />', $Rules);
                        echo $rule;
                    ?>
                </p>
            </p>
        </div>
        <center>
            <input id="js-copytextarea" class="aip-address" value="connect IP:PORT"/>
        </center>
    </div>
    
    You can use GetStatus() to get basic info of your server.

    Don't miss to configure your SourceQuery.php file
     
  6. Sorry but it not works for me. Google Chrome write me HTTP ERROR 500
    Main
    Code:
    <?php
        header("Refresh:60");
       
        require __DIR__ . '/SourceQuery/bootstrap.php';
        use xPaw\SourceQuery\SourceQuery;    define( 'SQ_SERVER_ADDR', 'rust.royalportal.eu' );
        define( 'SQ_SERVER_PORT', 28015); // udp
        define( 'SQ_RCON_PORT', 28016); // tcp - only for SourceQuery::SOURCE
        define( 'SQ_TIMEOUT',     2 );
        define( 'SQ_ENGINE',      SourceQuery::SOURCE );    $Query = new SourceQuery( );
        try{
            $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_RCON_PORT, SQ_TIMEOUT, SQ_ENGINE );
        $Informations = $Query->GetInfo( );
        $connected = $Query->GetConnected($Rustapikey);
        $Query->Disconnect( );
        }
        catch( Exception $e ){
        echo $e->getMessage( );
        }
    ?>
    
    SourceQuery.php
    Code:
    const SERVER_API_ADDRESS = 'rust.royalportal.eu';
            const SERVER_API_PORT = '28015';
    
     
  7. put that just after <?

    Code:
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
     
  8. I musted install XAMPP because webhosting not shows errors.
    Code:
    Fatal error: Uncaught Error: Class 'DB' not found in C:\xampp\htdocs\SourceQuery\SourceQuery.php:114 Stack trace: #0 C:\xampp\htdocs\index.php(13): xPaw\SourceQuery\SourceQuery->__construct() #1 {main} thrown in C:\xampp\htdocs\SourceQuery\SourceQuery.php on line 114
    
     
  9. I updated repository, i added mysql class
     
  10. I downloaded newest build from github but it still not working. What now ?
     
  11. what error?
    you have to correct path
     
  12. Where i need add mysql folder ?
     
  13. Well root, but your SourceQuery api should be in the api folder to, so it's better for you to check path
     
  14. I have all in root folder index.php and SourceQuery which I downloaded from github
     
  15. i'll update github
    [DOUBLEPOST=1501427460][/DOUBLEPOST]
    Code:
    <?php
        header("Refresh:60");
      
        require __DIR__ . '/SourceQuery/bootstrap.php';
        include_once(__DIR__ ."/api/mysql/Db.class.php");
        use xPaw\SourceQuery\SourceQuery;    define( 'SQ_SERVER_ADDR', 'rust.royalportal.eu' );
        define( 'SQ_SERVER_PORT', 28015); // udp
        define( 'SQ_RCON_PORT', 28016); // tcp - only for SourceQuery::SOURCE
        define( 'SQ_TIMEOUT',     2 );
        define( 'SQ_ENGINE',      SourceQuery::SOURCE );    $Query = new SourceQuery( );
        try{
            $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_RCON_PORT, SQ_TIMEOUT, SQ_ENGINE );
        $Informations = $Query->GetInfo( );
        $connected = $Query->GetConnected($Rustapikey);
        $Query->Disconnect( );
        }
        catch( Exception $e ){
        echo $e->getMessage( );
        }
    ?>
    Try this code
     
  16. Here is another error
    Code:
    Unhandled Exception. 
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. 
    You can find the error back in the log.
    Fatal error: Uncaught Error: Call to a member function Close() on null in C:\xampp\htdocs\SourceQuery\SourceQuery.php:178 Stack trace: #0 C:\xampp\htdocs\SourceQuery\SourceQuery.php(120): xPaw\SourceQuery\SourceQuery->Disconnect() #1 [internal function]: xPaw\SourceQuery\SourceQuery->__destruct() #2 {main} thrown in C:\xampp\htdocs\SourceQuery\SourceQuery.php on line 178
    
     
  17. You have to configure MySQL api
     
  18. Sorry but i have another error: Failed to read any data from socket
     
  19. that error mean you have something wrong with ip/port or your ip/port is blocked
     
  20. @GamerSK did you solved your problem?