SA-MP Forums Archive
[Help] Samp Query Api PHP detect my server offline - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Samp Query Api PHP detect my server offline (/showthread.php?tid=579666)



[Help] Samp Query Api PHP detect my server offline - pabloalber84 - 29.06.2015

Script:
The page: Page
PHP код:
<?php
require "SampQueryAPI.php";
$query = new SampQueryAPI('5.231.67.58''7777');
if(
$query->isOnline())
{
    
$aInformation $query->getInfo();
    
$aServerRules $query->getRules();
    
    
?>
    <b>General Information</b>
    <table width="400">
        <tr>
            <td>Hostname</td>
            <td><?= htmlentities($aInformation['hostname']) ?></td>
        </tr>
        <tr>
            <td>Gamemode</td>
            <td><?= htmlentities($aInformation['gamemode']) ?></td>
        </tr>
        <tr>
            <td>Players</td>
            <td><?= $aInformation['players'?> / <?= $aInformation['maxplayers'?></td>
        </tr>
        <tr>
            <td>Map</td>
            <td><?= htmlentities($aInformation['mapname']) ?></td>
        </tr>
        <tr>
            <td>Weather</td>
            <td><?= $aServerRules['weather'?></td>
        </tr>
        <tr>
            <td>Time</td>
            <td><?= $aServerRules['worldtime'?></td>
        </tr>
        <tr>
            <td>Version</td>
            <td><?= $aServerRules['version'?></td>
        </tr>
        <tr>
            <td>Password</td>
            <td><?= $aInformation['password'] ? 'Yes' 'No' ?></td>
        </tr>
    </table>
 
    <br />
    <b>Online Players</b>
    <?php
    
    $aPlayers 
$query->getDetailedPlayers();
    
    if(!
is_array($aPlayers) || count($aPlayers) == 0)
    {
        echo 
'<br /><i>None</i>';
    }
    else
    {
        
?>
        <table width="400">
            <tr>
                <td><b>Player ID</b></td>
                <td><b>Nickname</b></td>
                <td><b>Score</b></td>
                <td><b>Ping</b></td>
            </tr>
        <?php
        
foreach($aPlayers as $sValue)
        {
            
?>
            <tr>
                <td><?= $sValue['playerid'?></td>
                <td><?= htmlentities($sValue['nickname']) ?></td>
                <td><?= $sValue['score'?></td>
                <td><?= $sValue['ping'?></td>
            </tr>
            <?php
        
}
    
        echo 
'</table>';
    }
}
else echo 
'<br /><i>Offline</i>';
?>



Re: [Help] Samp Query Api PHP detect my server offline - kyriakos587 - 29.06.2015

Where you make it? If you make it on pawn remove it, if you make it with other software something going wrong with your GM or Fitlerscript


Respuesta: Re: [Help] Samp Query Api PHP detect my server offline - pabloalber84 - 29.06.2015

Quote:
Originally Posted by kyriakos587
Посмотреть сообщение
Where you make it? If you make it on pawn remove it, if you make it with other software something going wrong with your GM or Fitlerscript
Is PHP
The SAMP Query API is http://files.typefish.co.uk/sa-mp/SampQueryAPI.php


Re: [Help] Samp Query Api PHP detect my server offline - kyriakos587 - 29.06.2015

Maybe you wrote something incorrect while the server's stats were loading


Respuesta: [Help] Samp Query Api PHP detect my server offline - pabloalber84 - 29.06.2015

In the page yes loading....


Respuesta: [Help] Samp Query Api PHP detect my server offline - [DOG]irinel1996 - 29.06.2015

Try this.


Respuesta: [Help] Samp Query Api PHP detect my server offline - pabloalber84 - 29.06.2015

Quote:
Originally Posted by [DOG]irinel1996
Посмотреть сообщение
Try this.
Quote:

Oops! Server Is Currently Offline We'll Be Back Soon. Thanks For Waiting
Not loading..


Respuesta: [Help] Samp Query Api PHP detect my server offline - [DOG]irinel1996 - 29.06.2015

Maybe a port forwarding issue?

Did you try in your localhost?


Respuesta: [Help] Samp Query Api PHP detect my server offline - pabloalber84 - 29.06.2015

Quote:
Originally Posted by [DOG]irinel1996
Посмотреть сообщение
Maybe a port forwarding issue?

Did you try in your localhost?
Is ip 5.231.67.58:7777 and the script php has put in my page tz-rp.com.


Respuesta: [Help] Samp Query Api PHP detect my server offline - [DOG]irinel1996 - 29.06.2015

It works for me, look at the attached image.