Mysql Count Registered users?
#1

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?
Reply
#2

Help
Reply
#3

cache_insert_id()

Use in callback after insert query.
Reply
#4

Can someone show me the full code of this?
Reply
#5

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
Reply
#6

If the server is restarted,is it gonna reset the value?
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)