SA-MP Forums Archive
Problems with the Whirlpool Plugin - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems with the Whirlpool Plugin (/showthread.php?tid=260565)



Problems with the Whirlpool Plugin - Gomma - 09.06.2011

Hello,

This may seem like a noob'ish question to many of you but I thought I better ask now.

I have tried to create a simple Register System with the Whirlpool Plugin and dialogues. To make a register dialogue and store the password in hashed form into it by using dini was no problem but I really can't get the login dialogue working. How to check the inputtext - password?

Код:
if(dini_Get(pfile,"Password") == WP_Hash(buf,sizeof(buf),inputtext))
^ This code seems to fail hard. So please tell me how to check the password by using the whirlpool plugin.


Re: Problems with the Whirlpool Plugin - Miguel - 09.06.2011

You can't use '==' to compare strings, use strcmp instead:
pawn Код:
new string[129];

WP_Hash(string, sizeof(string), inputtext);
if(strcmp(string, dini_Get(pfile, "Password"), false) == 0)
{
    // Password matched.
}
else
{
    // Password didn't match.
}
You have to hash the inputtext (the text that the player typed) and compare it to the HASHED password you will get from the INI file. You have to remember hashing the password before saving them.

If you need help with strcmp: https://sampwiki.blast.hk/wiki/Strcmp

I used dini_Get as I believe (not sure though) it returns the password, so it's valid to use it as a string in strcmp.


AW: Problems with the Whirlpool Plugin - Gomma - 09.06.2011

Ah thanks a lot. Everything is working fine now.