[Tool/Web/Other] [PHP] Server Query and RCON API - Be an admin at ease! (16/02/2010)
#81

i mean where i put these files?
Reply
#82

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.
Reply
#83

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

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

*Sorry for bump.
Reply
#85

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!!";
?>
Reply
#86

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

Btw, thank you.
+REP
Reply
#87

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.
Reply
#88

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

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.
Reply
#90

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
Reply
#91

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
Reply
#92

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
Reply
#93

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']; 
?>
Reply
#94

Does not work anymore in Samp?
Reply
#95

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

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?
Reply
#97

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.
Reply
#98

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'>

Reply
#99

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?
Reply

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
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)