Password
#3

Quote:
Originally Posted by Private200
Посмотреть сообщение
Try deleting the WB_Hash from your native and then use this instead:

pawn Код:
stock WP_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;
}
Place it wherever at your script. After it, try using this as script.

pawn Код:
if(strlen(inputtext) >= 5 && strlen(inputtext) <= 20)
                {
                    new WPHash[129];
                    WP_Hash(WPHash, sizeof(WPHash), inputtext);
                    new INI:playerFile = INI_Open(UserPath(playerid));
                    INI_SetTag(playerFile, "statistics");
                    INI_WriteString(playerFile, "Password", WP_Hash(inputtext));
                    INI_WriteInt(playerFile, "Admin", 0);
                    INI_WriteInt(playerFile, "Kills", 0);
                    INI_WriteInt(playerFile, "Deaths", 0);
                    INI_WriteInt(playerFile, "Money", 0);
                    INI_Close(playerFile);
                   
                    format(dString, sizeof(dString), "Uspjeљno ste se registrirali pod imenom "CWHITE"'%s' "CRED"i lozinkom "CWHITE"'%s'"CRED". Zahvaljujemo na registracij!", GetName(playerid), inputtext);
                    SendClientMessage(playerid, RED, dString);
                }
AND after replacing that code with your REGISTER section, use this also:

pawn Код:
if(WP_Hash(inputtext) == PlayerInfo[playerid][Password])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
So, you shall remove this code from the LOGIN section:

pawn Код:
new WPHash[129];
                WP_Hash(WPHash, sizeof(WPHash), inputtext);
                if(!strcmp(WPHash, PlayerData[playerid][Password], false))
                {
                    INI_ParseFile(UserPath(playerid), "user_%s", .bExtra = true, .extra = playerid);
                }
Also, wherever you use the 'WPHash', don't add anything like 'new WPHash[129]' or anything else, you shall simply use the 'WP_Hash(inputtext)' and you're ready to go. Easier for you, so you don't have to edit anything else.

I think there shall be some warnings because you haven't deleted the unused functions, (new WPHash) etc. Just try to fix them, if you can't, post here.
You're being serious? WP Hash = Whirpool and that stock is udb_hash which came from dudb, Download the latest Whirpool plugin
Reply


Messages In This Thread
Password - by zerowhz - 05.11.2013, 19:51
Re: Password - by Private200 - 05.11.2013, 20:04
Re: Password - by Patrick - 05.11.2013, 20:08
Re: Password - by CrazyChoco - 05.11.2013, 20:12
Re: Password - by zerowhz - 05.11.2013, 20:13
Re: Password - by CrazyChoco - 05.11.2013, 20:16
Re: Password - by zerowhz - 05.11.2013, 20:20
Re: Password - by CrazyChoco - 05.11.2013, 20:28
Re: Password - by zerowhz - 05.11.2013, 20:31
Re: Password - by CrazyChoco - 05.11.2013, 20:47

Forum Jump:


Users browsing this thread: 1 Guest(s)