SA-MP Forums Archive
Online player count (+REP) - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Online player count (+REP) (/showthread.php?tid=607702)



Online player count (+REP) - Amit1998 - 22.05.2016

Hey guys,
been trying to make some online statistics for my server(starting off with an online player count - "There are X players online!")
Anywho, the PHP classes I was using seems to be outdated as they work only on a localhost and not on an actual website host, regardless of the PHP versions(I was using Woet's). If someone could please help me out and give me a new method on how to record these, I'd be thankful.

+REPing the helper.


Re: Online player count (+REP) - Luicy. - 22.05.2016

Use a loop,
PHP код:
new usersOnline 0;
for(new 
0MAX_PLAYERSi++)
{
    if(
IsPlayerConnected(i))
    {
         
usersOnline++;
    }




Re: Online player count (+REP) - JasperM - 22.05.2016

Quote:
Originally Posted by Meller
Посмотреть сообщение
Use a loop,
PHP код:
new usersOnline 0;
for(new 
0MAX_PLAYERSi++)
{
    if(
IsPlayerConnected(i))
    {
         
usersOnline++;
    }

Obviously this is about PHP, not PAWN. I made something similar some time ago, lets see if I can find it.


Re: Online player count (+REP) - Amit1998 - 22.05.2016

Quote:
Originally Posted by Meller
Посмотреть сообщение
Use a loop,
PHP код:
new usersOnline 0;
for(new 
0MAX_PLAYERSi++)
{
    if(
IsPlayerConnected(i))
    {
         
usersOnline++;
    }

was talking about a PHP version for a website
Quote:
Originally Posted by JasperM
Посмотреть сообщение
Obviously this is about PHP, not PAWN. I made something similar some time ago, lets see if I can find it.
Thanks a lot, because every single version I tried using, regardless of the author, doesn't work elsewhere rather than on the localhost(my PC), when I upload it to my website it says that the server is offline when it's up O_O


Re: Online player count (+REP) - Amit1998 - 22.05.2016

think I found smth, will let u guys know in a few.


Re: Online player count (+REP) - JasperM - 22.05.2016

Quote:
Originally Posted by Amit1998
Посмотреть сообщение
was talking about a PHP version for a website


Thanks a lot, because every single version I tried using, regardless of the author, doesn't work elsewhere rather than on the localhost(my PC), when I upload it to my website it says that the server is offline when it's up O_O
Seems like I am getting that same problem with my old script aswell. I remember that I once had a problem with my host blocking certain outgoing connections, after which I requested him to open some ports and it resolved the problem. Therefore, if you run your website on a VPS, I don't think you would expire any issues, but I don't think that's what you're doing + I can't test it out for you.


Re: Online player count (+REP) - Amit1998 - 22.05.2016

Quote:
Originally Posted by JasperM
Посмотреть сообщение
Seems like I am getting that same problem with my old script aswell. I remember that I once had a problem with my host blocking certain outgoing connections, after which I requested him to open some ports and it resolved the problem. Therefore, if you run your website on a VPS, I don't think you would expire any issues, but I don't think that's what you're doing + I can't test it out for you.
I have tried using 3 different hosts(000webhost, some foreign host and doteasy). Do you know a good hosting provider?


Re: Online player count (+REP) - Amit1998 - 22.05.2016

Anyone knows what's bugging my script on my web host? It works fine on a localhost
(The bug is that the player count is not shown)