INI_ParseFile problems - Y_INI
#1

Well, I'm having a problem with the ParseFile function in my user system..

I have this;

pawn Код:
enum    pData
{
    Password[64]
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_String( "Password",     p_Data[playerid][Password], 64);
    return 1;
}
pawn Код:
stock FetchTheirAccountLocation(playerid)
{
    new
        string[MAX_PLAYER_NAME],
        p_Name[MAX_PLAYER_NAME]
    ;
   
    GetPlayerName(playerid, p_Name, sizeof(p_Name));
    format(string, sizeof(string), USERDATA_PATH, p_Name);
    return string;
}
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(  FetchTheirAccountLocation(playerid) )) {

        INI_ParseFile(FetchTheirAccountLocation(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, d_Login, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome back!", "{FFFFFF}Please type your {2A9107}password {FFFFFF}below to access your account information!", "Connect", "Quit");

    }
    else {

        ShowPlayerDialog(playerid, d_Register, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome!", "{FFFFFF}Please type your {2A9107}password {FFFFFF}below to create your account and {2A9107}save {FFFFFF}your information!", "Join", "Quit");

    }
   
    p_LoggedIn{playerid} = false;
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case d_Register: {
           
            if(response) { //They clicked Register!
           
                if(!strlen(inputtext))
                    return ShowPlayerDialog(playerid, d_Register, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome!", "{FFFFFF}Please type your {2A9107}password {FFFFFF}below to create your account and {2A9107}save {FFFFFF}your information!", "Join", "Quit");
           
                new
                    INI:AccountData = INI_Open(FetchTheirAccountLocation(playerid))
                ;
           
                INI_SetTag(AccountData,     "Account Data");

                new pwStr[64];
                format(pwStr, 64, "%s", inputtext);
                p_Data[playerid][Password] = pwStr;
                INI_WriteString(AccountData,"Password",         pwStr);
               
                INI_Close(AccountData);
               
                p_LoggedIn{playerid} = true;
           
            }
            else {
                SendClientMessage(playerid, COLOR_ERROR, "Sorry! You are required to register before playing!");
                return Kick(playerid);
            }
           
        }
       
        case d_Login: {
       
            if(!response) {
                SendClientMessage(playerid, COLOR_ERROR, "Sorry! You are required to register before playing!");
                return Kick(playerid);
            }
       
            if(!strlen(inputtext))
                return ShowPlayerDialog(playerid, d_Login, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome back!", "{FFFFFF}Please type your {2A9107}password {FFFFFF}below to access your account information!", "Connect", "Quit");
       
            if(strcmp(inputtext, p_Data[playerid][Password], true) == 0) {
           
                INI_ParseFile(FetchTheirAccountLocation(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
               
            }
            else return ShowPlayerDialog(playerid, d_Login, DIALOG_STYLE_PASSWORD, "{009AC9}Welcome back!", "{FFFF00}You have entered an incorrect password!\n{FFFFFF}Please type your {2A9107}password {FFFFFF}below to access your account information!", "Connect", "Quit");
        }
    }
    return 1;
}
The ParseFile doesn't seem to be working, the password saves correctly to my file, but if I have:

pawn Код:
if(strcmp(inputtext, p_Data[playerid][Password], true) == 0) {
It will let any password log in.

but, if I do:

pawn Код:
if(strcmp(inputtext, "test", true) == 0) {
It works properly.

What's wrong? I really need to get this working, and I can't seem to figure it out.
Reply


Messages In This Thread
INI_ParseFile problems - Y_INI - by 2KY - 22.01.2012, 19:42
Re: INI_ParseFile problems - Y_INI - by DonWade - 22.01.2012, 20:38
Re: INI_ParseFile problems - Y_INI - by 2KY - 22.01.2012, 20:41
Re: INI_ParseFile problems - Y_INI - by StreetGT - 22.01.2012, 22:33
Re: INI_ParseFile problems - Y_INI - by 2KY - 22.01.2012, 22:57
Re: INI_ParseFile problems - Y_INI - by 2KY - 22.01.2012, 23:12
Re: INI_ParseFile problems - Y_INI - by Gh05t_ - 22.01.2012, 23:18

Forum Jump:


Users browsing this thread: 1 Guest(s)