Calculating Total Accounts Created?
#1

Hello,
Im making my own roleplay server and have decided to add in a feature that tells the users how many acounts have been created on the server, however i do not know how to do this. I have a login/register system created and know how to use enums (if that helps). Could anybody give me a suggestion on how to create it?
Reply
#2

use getplayerip then loop through all stats for the ip and if the ip exsist notify the player
Reply
#3

new TotalAccountsCreated;

in your register section, add TotalAccountsCreated++;

and of course, save it where ever you want.
Reply
#4

If you're planning on implementing MySQL, you can just query
pawn Код:
SELECT COUNT(*) FROM `table_name`
and that will return the number of rows in a table.
Reply
#5

And in the other case just use fexist with wildcards. For example:
pawn Код:
new totalaccounts = fexist("/accounts/*.ini");
Reply
#6

delete -
Reply
#7

dude its simple just create a new var like:

new totalaccs;

and onfilterscriptinit parse the files by Yini ... or which ever saving system u are using after that onplayerregister command or in the dialog section add
totalaccs++;
then update the file in yini done. ..
Reply
#8

For MySQL:
pawn Код:
stock GetTotalAccounts()
{
    new myQuery[256], total;
    format(myQuery, sizeof(myQuery), "SELECT * FROM `Tablename`");
    mysql_query(myQuery);
    mysql_store_result();
    total = mysql_num_rows();
    mysql_free_result();
    return total;
}
Reply
#9

Why do you people insist on posting wrong answers when two right answers already have been given? And fetching a whole table instead of a single field? Are you kidding me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)