[PHP] Query to show online players on website -
toofast - 05.07.2013
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!
Re: [PHP] Query to show online players on website -
TheJayMan - 05.07.2013
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.
Re: [PHP] Query to show online players on website -
toofast - 05.07.2013
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
|
Re: [PHP] Query to show online players on website -
TheJayMan - 05.07.2013
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;
}
?>
Re: [PHP] Query to show online players on website -
toofast - 05.07.2013
Thanks, worked fine. And for the hostname, mode and map? Thanks!
Re: [PHP] Query to show online players on website -
toofast - 05.07.2013
Thanks mate!