SA-MP Forums Archive
[Tool/Web/Other] [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) (/showthread.php?tid=104299)

Pages: 1 2 3 4 5 6


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - Tisot - 20.08.2014

i mean where i put these files?


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - nickdodd25 - 29.08.2014

Quote:
Originally Posted by Mark_Weston
Посмотреть сообщение
Returns an empty statement for some reason.

http://instantgaming.net/

Код:
Live Server Status General Information
Hostname	
Gamemode	
Players	 /
Map	
Weather	
Time	
Version	
Password	

Online Players
Player ID	Nickname	Score
So i've been making my own monitor/server checker and i have unfortunately been having this identical issue. I am thinking its some type of timeout issue but i have yet to find a fix for it. Anyone else besides us have this issue? Or have a way to fix it?

EDIT: Kinda found a no so great workaround but it does work.
I have a while loop and it loops until players online is 0 or greater and maxplayers is 1 or greater, during the loop it pauses for a second to avoid spamming the server. And if its offline it simply just breaks the loop.

So it basically keeps retrying until it gets a actual player/maxplayer count that's right. Seems to be running smoothly atm. Kind of a not so efficient way to do it but it does work. I'm sure there's a better way.


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - papagei9 - 15.05.2015

Hi, is there a working version for SA:MP 0.3.7?


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - ZaBraNjeNi - 03.10.2016

How can I show only first 5 players online from server?

*Sorry for bump.


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - BroZeus - 04.10.2016

Quote:
Originally Posted by ZaBraNjeNi
Посмотреть сообщение
How can I show only first 5 players online from server?

*Sorry for bump.
PHP код:
<?php
require "SampQueryAPI.php";
$query = new SampQueryAPI('127.0.0.1''7777');
if(
$query->isOnline())
{
    
$players $query->getDetailedPlayers();
    
    if(!
is_array($players) || count($players) == 0)
    {
        echo 
'No players on :*(';
    }
    else
    {
        echo 
"PLayer list:<br>";
        
$count 1;
        foreach(
$players as $value)
        {
            if(
$count == 6)break;            
            echo 
$count.". "htmlentities($value['nickname']) . " <br>";            
            
$count++;
        }
    }
}
else echo 
"Server offline!!";
?>



Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - ZaBraNjeNi - 05.10.2016

If server have 100+ players I'll get message "No players on :*(".

Btw, thank you.
+REP


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - BroZeus - 06.10.2016

Quote:
Originally Posted by ZaBraNjeNi
Посмотреть сообщение
If server have 100+ players I'll get message "No players on :*(".

Btw, thank you.
+REP
Well yes, but it has a fix too but for that you won't be using this api, for that you just need to create an extra field in the db that you are using say "online" set it to 1 when player connects and 0 on disconnect then select rows from db which has on‌line = 1 to get all online players.


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - KokyZ - 06.02.2017

please help
Код:
Notice:  fwrite(): send of 15 bytes failed with errno=1 Operation not permitted in /public_html/includes/SampQueryAPI.php on line 61



Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - azzerking - 06.02.2017

Quote:
Originally Posted by KokyZ
Посмотреть сообщение
please help
Код:
Notice:  fwrite(): send of 15 bytes failed with errno=1 Operation not permitted in /public_html/includes/SampQueryAPI.php on line 61
It means the socket was unable to access the server by the ip and port, make sure your hosting provider allows you to use sockets and access through the firewall. Also make sure the server is online and allowed to be queried.


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - KokyZ - 06.02.2017

iam checking if its offline arn't and its checking successfully and it says that its ofline becuse iam checking for a offline ip becuase i haven't server yet (my server gonna) so i have tried BT 3.7 Server's ip for test and it didn't work too


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - KokyZ - 07.02.2017

Quote:
Originally Posted by KokyZ
Посмотреть сообщение
iam checking if its offline arn't and its checking successfully and it says that its ofline becuse iam checking for a offline ip becuase i haven't server yet (my server gonna) so i have tried BT 3.7 Server's ip for test and it didn't work too
please help guys the proplem didn't get fixed yet and i have new error too all the errors is cuased by this API not by me
Код:
Notice: fwrite(): send of 15 bytes failed with errno=1 Operation not permitted in /public_html/includes/SampQueryAPI.php on line 61
Notice: Undefined variable: aDetails in /public_html/includes/SampQueryAPI.php on line 293
please help guys


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - KokyZ - 17.02.2017

thnx guys all my proplems has been fixed and a big thanks to @DRIFT_HUNTER for helping me but i have last one proplem and its it detects Language as mapname such as 'Map: English' not 'Map: Everything' would be great if someone told me how to fix this prop please


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - 4D1L - 25.02.2017

Quote:
Originally Posted by KokyZ
Посмотреть сообщение
thnx guys all my proplems has been fixed and a big thanks to @DRIFT_HUNTER for helping me but i have last one proplem and its it detects Language as mapname such as 'Map: English' not 'Map: Everything' would be great if someone told me how to fix this prop please
As of 0.3.7, the Mapname column in the samp client was changed to a language tab to help players distinguish the language of the server they would be playing on. However, the mapname is still found in the client under the server rules. In this PHP api, you can retrieve the map name like this:

PHP код:
<?php
    
require "SampQueryAPI.php";
    
$query = new SampQueryAPI('localhost''7777');
    
$aServerRules $query->getRules();
    echo 
$aServerRules['mapname']; 
?>



Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - Romz - 27.09.2017

Does not work anymore in Samp?


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - cuber - 27.09.2017

Quote:
Originally Posted by Romz
Посмотреть сообщение
Does not work anymore in Samp?
Did you set the query to "query 1" on your server.cfg?


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - Romz - 27.09.2017

Quote:
Originally Posted by cuber
Посмотреть сообщение
Did you set the query to "query 1" on your server.cfg?
No, without that I can not do it?


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - cuber - 27.09.2017

Quote:
Originally Posted by Romz
Посмотреть сообщение
No, without that I can not do it?
Nope. Btw, the sa-mp query protocol is changed on the new release.


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - Rusich - 05.11.2017

Can I output something like js?
Output by this type:
Quote:

<script language='JavaScript' src='http://monitoring.ru/mon/info.php?&ip=IP&port=PORT&info=map'>




Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - SupperRobin6394 - 05.11.2017

Quote:
Originally Posted by Rusich
Посмотреть сообщение
Can I output something like js?
Output by this type:
You mean as in print those lines into the webpage?


Re: [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010) - Rusich - 06.11.2017

Quote:
Originally Posted by SupperRobin6394
Посмотреть сообщение
You mean as in print those lines into the webpage?
To be able to display information on the site in this form.

I apologize for my broken English. I'm from Russia