SA-MP Forums Archive
Help - Change 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: Help - Change password (/showthread.php?tid=542309)



Fixed. - Edw - 18.10.2014

Fixed.


Re: Help - Change password - austin070 - 18.10.2014

How is PlayerInfo[playerid][pPass] defined? Assuming it's correct, try using this:

pawn Код:
if(strcmp(udb_hash(inputtext), PlayerInfo[playerid][pPass], true)== 0)



Re: Help - Change password - Sledgehammer - 18.10.2014

Quote:
Originally Posted by austin070
Посмотреть сообщение
How is PlayerInfo[playerid][pPass] defined? Assuming it's correct, try using this:

pawn Код:
if(strcmp(udb_hash(inputtext), PlayerInfo[playerid][pPass], true)== 0)
Wouldn't work. UBD hash is converted from a string to a number.


Re: Help - Change password - Crayder - 18.10.2014

Quote:
Originally Posted by Death1300
Посмотреть сообщение
Wouldn't work. UBD hash is converted from a string to a number.
Strcmp does not convert anything, it just checks to see if they match at the given points. Also, it's not a number, it's either an integer or float. UDB hash returns a number, but you could format it into a string if you needed to.

Make sure your UDB_HASH is like this.
pawn Код:
stock udb_hash(buf[]) {
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}



Fixed. - Edw - 18.10.2014

Fixed.


Re: Help - Change password - Crayder - 18.10.2014

Show us your command, all of it.


Fixed. - Edw - 18.10.2014

Fixed.