[PHP] Query to show online players on website
#1

Hello,

Can someone help me with a PHP function that shows the online players next to the "Players:" text?

Also, i would like to make a page with all the registered accounts, so i need to extract them for table players.

If someone can help me with one of those please post there. Thanks in advance!
Reply
#2

Check out this class.
----
https://sampforum.blast.hk/showthread.php?tid=355574

There's an example which shows how to use the GetInfo() function, this returns everything you will need related to the server information (it's the same as looking at the server browser...)

If you meant something else, sorry.
Reply
#3

Thanks, but seems is not working fine. I get the information but also the array is displayed.
Quote:

Connected

Array ( [password] => 0 [players] => 0 [maxplayers] => 200 [hostname] => TESTE GodLike RPG [gamemode] => GodLike RPG v1 [map] => San Andreas )

Array ( )

Array ( )

Array ( [gravity] => 0.008 [mapname] => San Andreas [version] => 0.3x [weather] => 10 [weburl] => www.godlike.ro [worldtime] => 11:00 )

5

Reply
#4

Quote:
Originally Posted by toofast
Посмотреть сообщение
Thanks, but seems is not working fine. I get the information but also the array is displayed.
Well, here's a simple way of getting just the player count value.

PHP код:
<?php
while($server $query->getInfo())
{
    echo 
$server["players"];
    break;
}
?>
Reply
#5

Thanks, worked fine. And for the hostname, mode and map? Thanks!
Reply
#6

Thanks mate!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)