04.06.2018, 08:13
I've made the players register date save via getdate function.Now once player registers an account and types /stats, the date is 0/0/0000, but once he relogs the date loads.I don't save the date OnPlayerDisconnect or something like that, i save it just as player registers.Now my question is, how do i load the date just as player registers?
Код:
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. } }