[y_ini]Date loading issue
#1

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.
			}
        }
Reply
#2

Does it save it in the file when registering though?
Reply
#3

Y_ini should save the full registered players to a "folder/file" in scriptfiles so you just have to define it in OnPlayerConnect and OnPlayerDisconnect.
Reply
#4

Quote:
Originally Posted by Stefand
Посмотреть сообщение
Does it save it in the file when registering though?
I just checked, and it did saved the date in players ini file i just registered.Here's the stats cmd.

Код:
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;
}
Reply
#5

Bump
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
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.
Where can i get a better password hash?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)