SA-MP Forums Archive
Not logging me in? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Not logging me in? (/showthread.php?tid=389422)



Not logging me in? - RLGaming - 02.11.2012

pawn Code:
if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hinfo[20];
            if(PlayerInfo[playerid][pHouseKey] == -1)
            { hinfo = "Unavailable"; }
            else if(PlayerInfo[playerid][pHouseKey] >= -1)
            { hinfo = "Available"; }
            if(udb_hash(inputtext) == PlayerInfo[playerid][pPassword])
            {
                TogglePlayerSpectating(playerid, 0);
                INI_ParseFile(UserSavePath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                SendClientMessage(playerid, COLOR_LIGHTRED, "You have entered your password correct! Logged in successfully.");
                SpawnPlayer(playerid);
                SetPlayerStuff(playerid);
                SetPlayerPos(playerid, PlayerInfo[playerid][PlayerPos][0], PlayerInfo[playerid][PlayerPos][1], PlayerInfo[playerid][PlayerPos][2]);
                gLoggedIn[playerid] = 1000;
            }
            else ShowPlayerDialog(playerid, DIALOG_ERROR, DIALOG_STYLE_MSGBOX, "{DE0D0D}Error!", "{EDC72F}You have entered an invalid password.\n\n{CF0808}You have been kicked.", "Close", "");
            //Kick(playerid);
        }
    }
Thats my login code, but for some reason its being a fucking shit-head(sorry for rage).

No-matter what it ALWAYS say its invalid, when it clearly isn't, i've registered shit load of different accs to test it and its generally being a *****..
My register dialog with the PW saving:
pawn Code:
if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(udb_hash(inputtext) > 5)
            {
                new genderstring[96];
                TutorialPassword[playerid] = udb_hash(inputtext);
                gLoggedIn[playerid] = 5;
                format(genderstring, sizeof(genderstring), "%s, choose your gender!", GetPlayerNameEx(playerid));
                ShowPlayerDialog(playerid, DIALOG_REGISTERGENDER, DIALOG_STYLE_LIST, genderstring, "I am a male!\nI am a female!", "Select", "Cancel");
            }
        }
    }
Then at the end of the tut it turns the TutorialPassword into a INI_WriteInt
pawn Code:
INI_WriteInt(File, "Password", TutorialPassword[playerid]);
Any help:/


Re: Not logging me in? - RLGaming - 02.11.2012

pawn Code:
if(fexist(UserSavePath(playerid)))
    {
        INI_ParseFile(UserSavePath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        format(string, sizeof(string), "/Users/%s.ini", PlayerName);
        format(string1, sizeof(string1), "Hello %s, welcome back!", GetPlayerNameEx(playerid));
        format(string2, sizeof(string2), "Welcome back %s, to "GM_NAME"! We have found your account registered in the database.\n\nEnter your password to login!", GetPlayerNameEx(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, string1, string2, "Login!", "Cancel");
    }
(OnPlayerConnect)
Its loading it here, although it just wont, ugh getting so frustrated with this


Re: Not logging me in? - RLGaming - 02.11.2012

How would I do it? Where? This has really confused me


Re: Not logging me in? - RLGaming - 02.11.2012

Anyone?


Re: Not logging me in? - -=Dar[K]Lord=- - 02.11.2012

instead of
pawn Code:
if(fexist(UserSavePath(playerid)))
    {
        INI_ParseFile(UserSavePath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        format(string, sizeof(string), "/Users/%s.ini", PlayerName);
        format(string1, sizeof(string1), "Hello %s, welcome back!", GetPlayerNameEx(playerid));
        format(string2, sizeof(string2), "Welcome back %s, to "GM_NAME"! We have found your account registered in the database.\n\nEnter your password to login!", GetPlayerNameEx(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, string1, string2, "Login!", "Cancel");
    }

USE


pawn Code:
if(fexist(UserSavePath(playerid)))
    {
        INI_ParseFile(UserSavePath(playerid), "LoadUser_user", .bExtra = true, .extra = playerid);//or what ever u have like LoadUser_User or the LoadUser_Account
        format(string, sizeof(string), "/Users/%s.ini", PlayerName);
        format(string1, sizeof(string1), "Hello %s, welcome back!", GetPlayerNameEx(playerid));
        format(string2, sizeof(string2), "Welcome back %s, to "GM_NAME"! We have found your account registered in the database.\n\nEnter your password to login!", GetPlayerNameEx(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, string1, string2, "Login!", "Cancel");
    }