SA-MP Forums Archive
Samp API Query Mechanism - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Samp API Query Mechanism (/showthread.php?tid=546824)



Samp API Query Mechanism - Clivlend - 18.11.2014

Hi.
Link: mp.com/wiki/Query_Mechanism#SA-MP_Packets_in_the_real_world
Link 2:https://sampforum.blast.hk/showthread.php?tid=104299

How to get players with more than 100 online?

Code class "PHP"
PHP код:
    public function getBasicPlayers() {
        @
fwrite($this->sock, $this->assemblePacket("c"));
        
fread($this->sock, 11);
        
$playerCount = ord(fread($this->sock, 2));
        
$players = array();
        if(
$playerCount > 0) {
            for(
$i = 0; $i < $playerCount; ++$i) {
                
$strLen = ord(fread($this->sock, 1));
                
$players[$i] = array
                (
                    
"name" => (string) fread($this->sock, $strLen),
                    
"score" => (integer) $this->toInt(fread($this->sock, 4)),
                );
            }
        }
        return 
$players;
    } 
Receives only 100 players....


Re: Samp API Query Mechanism - Clivlend - 18.11.2014

Please, help me!


Re: Samp API Query Mechanism - GWMPT - 18.11.2014

SA-MP don't give the output of players(just the number of players connected) when there are more than 100 players connected.


Re: Samp API Query Mechanism - Clivlend - 18.11.2014

There are options for how to get all the players?


Re: Samp API Query Mechanism - GWMPT - 18.11.2014

If you're going to use it for your own server, there are ways.
For example:
You had a new column in the Player table, with the name "connected"(smallint)
When a player connect, and load his data, you put the value there for 1.
When the player disconnects, change the value for 0

Now, you just need to query the database, example:
Код:
SELECT `Name`,`Score` FROM  `Players` WHERE `Connected` = 1
This should do the trick


Re: Samp API Query Mechanism - Clivlend - 18.11.2014

No, i'm build samp base. Over server. Need get online players.


Re: Samp API Query Mechanism - nickdodd25 - 18.11.2014

Then make some type of script that stores online players like Kikito suggested.

As you can read just below from where your link takes you it says that the the packets for player lists are throttled to 100 users. https://sampwiki.blast.hk/wiki/Query_Mec...e_packet_table


Re: Samp API Query Mechanism - Clivlend - 19.11.2014

But...
It stands for client list, this sends back to the server the players' name, and then the players' score. Just imagine it as a basic overview of all the players. Throttled to 100, but can theoretically support 65536 different IDs.

Probably still available online over 100?


Re : Samp API Query Mechanism - Nicow - 19.11.2014

It should be but it's throttled to 100, we can't bypass the limitation