Calculating Total Accounts Created? -
stuoyto - 06.11.2012
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?
Re: Calculating Total Accounts Created? -
Glad2BeHere - 06.11.2012
use getplayerip then loop through all stats for the ip and if the ip exsist notify the player
Re: Calculating Total Accounts Created? -
cosbraa - 06.11.2012
new TotalAccountsCreated;
in your register section, add TotalAccountsCreated++;
and of course, save it where ever you want.
Re: Calculating Total Accounts Created? -
ReneG - 06.11.2012
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.
Re: Calculating Total Accounts Created? -
Vince - 06.11.2012
And in the other case just use fexist with wildcards. For example:
pawn Код:
new totalaccounts = fexist("/accounts/*.ini");
Re: Calculating Total Accounts Created? -
Djole1337 - 06.11.2012
delete -
Re: Calculating Total Accounts Created? -
-=Dar[K]Lord=- - 06.11.2012
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. ..
Re: Calculating Total Accounts Created? -
Djole1337 - 06.11.2012
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;
}
Re: Calculating Total Accounts Created? -
Vince - 06.11.2012
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?