SA-MP Forums Archive
Mysql Count Registered users? - 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: Mysql Count Registered users? (/showthread.php?tid=586221)



Mysql Count Registered users? - PowerF - 20.08.2015

i know it by this

Код:
mysql_query("SELECT COUNT(`playerName`) FROM playerdata");
but how do i it when the player registered and the server says total registered to all online players?


Re: Mysql Count Registered users? - PowerF - 20.08.2015

Help


Re: Mysql Count Registered users? - Vince - 20.08.2015

cache_insert_id()

Use in callback after insert query.


Re: Mysql Count Registered users? - PowerF - 20.08.2015

Can someone show me the full code of this?


Re: Mysql Count Registered users? - Jefff - 20.08.2015

You can load all in OnGameModeInit

top
new TotalUsers;

OnGameModeInit
mysql_query("SELECT COUNT(*) FROM playerdata");
TotalUsers = mysql_fetch_int
mysql_free_result

and when new player is register
TotalUsers++;
format(str,sizeof(str),"total users: %d",TotalUsers);
SCMToAll


Re: Mysql Count Registered users? - PowerF - 20.08.2015

If the server is restarted,is it gonna reset the value?


Re: Mysql Count Registered users? - Jefff - 20.08.2015

No because its doing again
mysql_query("SELECT COUNT(*) FROM playerdata");
TotalUsers = mysql_fetch_int
mysql_free_result