SA-MP Forums Archive
strcmp, wrong password... - 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: strcmp, wrong password... (/showthread.php?tid=332290)



strcmp, wrong password... - Itzhak E. - 07.04.2012

When I'm comparing the two strings it'n saying wrong password, even the password correct.
Password is hashed in player file.ini
pawn Код:
if(strcmp(hash(inputtext), pData[playerid][Password]) == 0)

// Loading player data
forward LoadUser_Data(playerid,name[],value[]);
public LoadUser_Data(playerid,name[],value[])
{
    INI_Int("Password",pData[playerid][Password]);
    INI_Int("Admin",pData[playerid][Admin]);
    INI_Int("Level",pData[playerid][Level]);
    INI_Int("Kills",pData[playerid][Kills]);
    INI_Int("Deaths",pData[playerid][Deaths]);
    return 1;
}
help please


Re: strcmp, wrong password... - Jonny5 - 07.04.2012

what kinda hash you using?

if its not a string hash then you wont need to use strcmp


pawn Код:
if(hash(inputtext) == pData[playerid][Password])



Re: strcmp, wrong password... - Itzhak E. - 07.04.2012

this is string... password may contains letters/numbers..


Re: strcmp, wrong password... - Jonny5 - 07.04.2012

yes the inputtext is a string but what type does the hash return?
my guess is an int.!

and this was my hint
pawn Код:
INI_Int("Password",pData[playerid][Password]);
INI_Int is an int
otherwise it would be INI_String


Re: strcmp, wrong password... - Itzhak E. - 07.04.2012

I'm using hash(inputtext) in dutils include I think..


Re: strcmp, wrong password... - Jonny5 - 07.04.2012

did you ever try what i suggested?
im sure youll find its a fix!

regards,


Re: strcmp, wrong password... - Itzhak E. - 07.04.2012

Solved, I did 1 thing wrong, in load I writted INI_Int, I should writted INI_String, because my password it's string..
anyway +rep you.