case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
new pass = PlayerInfo[playerid][pPassword];
new string[300];
new Year, Month, Day;
getdate(Year, Month, Day);
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"NewReg",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Xpos",0);
INI_WriteInt(File,"Ypos",0);
INI_WriteInt(File,"Zpos",0);
INI_WriteInt(File,"Angle",0);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Bankmoney",0);
INI_WriteInt(File,"Health",0);
INI_WriteInt(File,"Armor",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Regyear",Year);
INI_WriteInt(File,"Regmonth",Month);
INI_WriteInt(File,"Regday",Day);
INI_Close(File);
format(string,sizeof(string),"Account has been registered and you've been automatically logged in.Password: %d",pass);
SendClientMessage(playerid,-1,string);
PlayerInfo[playerid][pNewReg] = 1; // Adding a variable that this is a NEW registrator and he doesn't have an old saved position and skin.
}
}
CMD:stats(playerid,params[])
{
new money = GetPlayerMoney(playerid);
new bankmoney = PlayerInfo[playerid][pBankmoney];
new kills = PlayerInfo[playerid][pKills];
new deaths = PlayerInfo[playerid][pDeaths];
new year = PlayerInfo[playerid][pRegyear];
new month = PlayerInfo[playerid][pRegmonth];
new day = PlayerInfo[playerid][pRegday];
new string[500];
format(string,sizeof(string),"{aae4ad}Registered on: {FFFFFF}%d/%d/%d (day, month, year)\n{FFFFFF}Money:{54AD3A} $%d {FFFFFF}(Bank balance: {54AD3A}$%d{FFFFFF})\n{EC6D5B}Kills: {FFFFFF}%d\t{EC6D5B}Deaths: {FFFFFF}%d",day,month,year,money,bankmoney,kills,deaths);
ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, "Your stats", string, "Close", "");
return 1;
}
|
1) You need a better password hash. A VASTLY better one.
2) Don't save dates as d/m/y, use a timestamp, and only a timestamp. |