public OnPlayerConnect(playerid)
{
new filecount;
filecount = // dunno what to do here
SendClientMessage(playerid, 0xFFFFFF, "Welcome to the server. Database has %i registered accounts",filecount);
return 1;
}
filecount = fexist("/UserAccounts/*");
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
if(dialogid == R_DIALOG)
{
if(!response) return Kick(playerid);
if(strlen(inputtext) < 6 || strlen(inputtext) > 100)
{
SendClientMessage(playerid, 0xFF0000AA,"Character Length is 5-15");
ShowPlayerDialog(playerid, R_DIALOG, DIALOG_STYLE_PASSWORD,"Registration","Your account isn't registered\n Please enter your desired password below","Register","Quit");
}
else if(strlen(inputtext) > 0 && strlen(inputtext) < 100)
{
new INI:file = INI_Open(UserAccount(playerid));
INI_SetTag(file,"data");
INI_WriteInt(file, "Password", udb_hash(inputtext));
INI_WriteInt(file,"Scores", 0);
INI_WriteInt(file,"Money", 0);
INI_WriteInt(file,"AdminLevel", 0);
INI_WriteInt(file,"Kills", 0);
INI_WriteInt(file,"Deaths", 0);
INI_WriteInt(file,"Helper", 0);
INI_Close(file);
PlayerInfo[playerid][pLogged] = 1;
new filecount;
new string3[256];
new string[100];
filecount = fexist("/UserAccounts/*");
format(string3,sizeof(string3),"Database has {FF9900}%i{FFFFFF} registered accounts",filecount);
SendClientMessage(playerid, 0xFFFFFF, string3);
format(string, sizeof(string),"Your password is: {00FF00}%s", inputtext);
SendClientMessage(playerid, 0xFFFFFF, string);
}
}
If you just have started/enabled registrations, you could add a variable TotalRegisteredPlayers++; under every successful registration, save it, and whenever required just format it and send it!
|