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
#2

https://sampforum.blast.hk/showthread.php?tid=273088
works for me
Reply
#3

Quote:
Originally Posted by DonWade
Посмотреть сообщение
That's the tutorial I followed... Odd.
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
How are "Account Data" and "data" the same thing? I REALLY need to finish my new y_ini tutorial for slow people with nice big pictures showing that if you WRITE a tag then READ that tag, they need to be THE SAME, as that for some reason is the hardest thing for people to grasp!

Or just use y_users and y_uvar, which require no effort at all.
you make your releases sometimes a little complex for new people.
Reply
#5

Quote:
Originally Posted by StreetGT
Посмотреть сообщение
you make your releases sometimes a little complex for new people.
You honestly do, ******. Not all of us have engineering degrees, and your releases may be the most efficient, but you document them not to the normal level a user is used to reading. It's very complex, and hard to understand most of the time.
Reply
#6

I've switched that, I did not understand the ParseFile function at all before that. Hense why I created this topic; although that diagram did help, although I didn't need it - your post was sufficient.

As for your topic-editing: I'm honestly not sure, but can you at least understand where we are coming from? We're not trying to be arrogant, it's just we don't understand things sometimes when they're put into technical terms (which I understand, with a technical degree, it may be hard not to do so!)
Reply
#7

Quote:
Originally Posted by StreetGT
Посмотреть сообщение
you make your releases sometimes a little complex for new people.
His releases aren't complex, nor near in anyway difficult to understand or interpret. The examples provided though, do show minor complexity, but this shouldn't be an issue if you simply READ it over. ******' releases go in-depth rather than explain the primary usage (which I don't believe is an issue). If your not "multilingual" (you do not relate to other programming languages) it WILL be quite difficult to understand how certain things work the way they do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)