SA-MP Forums Archive
Whirlpool help :s - 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: Whirlpool help :s (/showthread.php?tid=281308)



Whirlpool help :s - FireCat - 05.09.2011

Even tho if I type the correct password, it says wrong password, why?!
pawn Код:
if(dialogid == Logindialog)
    {
        if(!response) return Kick(playerid);
        new password[129],string[128],hashedpassword[129];
        format(file,sizeof(file),"FAdmin/Users/%s.ini",GetPName(playerid));
        INI_Open(file);
        INI_ReadString(hashedpassword,"Password");
        INI_Close();
        WP_Hash(password,129,inputtext);
        if(strcmp(hashedpassword,password) == 0)
        {
            LoadPlayerStats(playerid);
            PInfo[playerid][Regged] = true;
            PInfo[playerid][Logged] = 1;
        }
        else
        {
            PInfo[playerid][Failedlogins]++;
            format(string,sizeof(string),""cred"Attempts left: "cwhite"["corange"%i"cwhite"] \n"cwhite"Please type in your password to login",MAX_FAILED_LOGINS-PInfo[playerid][Failedlogins]);
            ShowPlayerDialog(playerid,Logindialog,1,"Login",string,"Login","");
            if(PInfo[playerid][Failedlogins] == MAX_FAILED_LOGINS)
            {
                format(string,sizeof(string),"%s has been kicked for %i failed logins",GetPName(playerid),MAX_FAILED_LOGINS);
                SendAdminMessage(red,string);
                Kick(playerid);
                SaveIn("Failedlogins",string,1);
            }
        }
        return 1;
    }



Re: Whirlpool help :s - =WoR=Varth - 05.09.2011

Debug your code and see both password.


Re: Whirlpool help :s - [HiC]TheKiller - 05.09.2011

Is the password typed into the input box the same as the one in the file (After hashing)? Use print on the whirlpool hash and compare it. It may be a problem with your saving function, not your loading one.


Re: Whirlpool help :s - FireCat - 05.09.2011

Nop they aren't the same.
My register dialog
pawn Код:
if(dialogid == Registerdialog)
    {
        if(!response && SInfo[MustRegister] == 1) return Kick(playerid);
        else if(!response && SInfo[MustRegister] == 0) return 0;
        if(strlen(inputtext) < 3 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid,Registerdialog,1,"Register",""cwhite"Please type in the "cred"desired "cwhite"password below \n"cred"More than 3 and less than 20 characters\n","Register","Cancel");
        new password[130];
        format(file,sizeof(file),"FAdmin/Users/%s.ini",GetPName(playerid));
        WP_Hash(password,130,inputtext);
        INI_Open(file);
        INI_WriteString("Password",password);
        INI_WriteInt("Money",GetPlayerMoney(playerid));
        INI_WriteInt("Score",GetPlayerScore(playerid));
        INI_WriteInt("ALevel",PInfo[playerid][Level]);
        INI_Save();
        INI_Close();
        LoadPlayerStats(playerid);
        PInfo[playerid][Regged] = true;
        PInfo[playerid][Logged] = 1;
        SendClientMessage(playerid,green2,"» You have successfully registered!");
    }



Re: Whirlpool help :s - =WoR=Varth - 05.09.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Nop they aren't the same.
My register dialog
pawn Код:
if(dialogid == Registerdialog)
    {
        if(!response && SInfo[MustRegister] == 1) return Kick(playerid);
        else if(!response && SInfo[MustRegister] == 0) return 0;
        if(strlen(inputtext) < 3 || strlen(inputtext) > 20) return ShowPlayerDialog(playerid,Registerdialog,1,"Register",""cwhite"Please type in the "cred"desired "cwhite"password below \n"cred"More than 3 and less than 20 characters\n","Register","Cancel");
        new password[130];
        format(file,sizeof(file),"FAdmin/Users/%s.ini",GetPName(playerid));
        WP_Hash(password,130,inputtext);
        INI_Open(file);
        INI_WriteString("Password",password);
        INI_WriteInt("Money",GetPlayerMoney(playerid));
        INI_WriteInt("Score",GetPlayerScore(playerid));
        INI_WriteInt("ALevel",PInfo[playerid][Level]);
        INI_Save();
        INI_Close();
        LoadPlayerStats(playerid);
        PInfo[playerid][Regged] = true;
        PInfo[playerid][Logged] = 1;
        SendClientMessage(playerid,green2,"» You have successfully registered!");
    }
pawn Код:
#define MAX_INI_ENTRY_TEXT 160//Before y_ini include



Re: Whirlpool help :s - FireCat - 05.09.2011

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
#define MAX_INI_ENTRY_TEXT 160//Before y_ini include[/pawn]
Who said I'm using y_ini? o:


Re: Whirlpool help :s - Jack_Leslie - 05.09.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Who said I'm using y_ini? o:
Код:
INI_Open(file);
Your code does.


Re: Whirlpool help :s - FireCat - 05.09.2011

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Код:
INI_Open(file);
Your code does.
I'm using SII.
EDIT:
FIXED


Re: Whirlpool help :s - =WoR=Varth - 05.09.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Who said I'm using y_ini? o:
Then what is it?

EDIT: Oh, then find a similiar define inside your include.


Re: Whirlpool help :s - [HiC]TheKiller - 05.09.2011

Can you print the values of the whirlpool hash when you type something in the register dialog and when you type something into the login dialog. This will determine if it's a saving issue or not.

EDIT: Nevermind, it was fixed.