SA-MP Forums Archive
Get 'false password' error eventhough password is correct - 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: Get 'false password' error eventhough password is correct (/showthread.php?tid=546301)



Get 'false password' error eventhough password is correct - Sellize - 14.11.2014

I put the correct pass but still it throws the error, why?

Code:
case DIALOG_LOGIN:
        {
            if (!response) return Kick ( playerid );
            if(response)
            {
                if(strcmp(inputtext, PlayerInfo[playerid][pPass], false))
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoneyEx(playerid, PlayerInfo[playerid][pCash]);
                    welcome(playerid);
                    NewMoney[playerid] = GetPlayerMoney(playerid);
                    PlayerInfo[playerid][pLogged] = 1;
                    ForceClassSelection(playerid);
				    TogglePlayerSpectating(playerid, true);
				    TogglePlayerSpectating(playerid, false);
                }
                else
                {
					slowkick(playerid, "Invalid password");
					PlayerInfo[playerid][pLogged] = 0;
                }
                return 1;
            }
        }



Re: Get 'false password' error eventhough password is correct - DavidBilla - 14.11.2014

if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))

This will fix it.
Strcmp returns 0 when both strings match, that's why you put '!'


Re: Get 'false password' error eventhough password is correct - Sellize - 15.11.2014

Quote:
Originally Posted by DavidBilla
View Post
if(!strcmp(inputtext, PlayerInfo[playerid][pPass], false))

This will fix it.
Strcmp returns 0 when both strings match, that's why you put '!'
Thank I shouldve known