SA-MP Forums Archive
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: Password (/showthread.php?tid=474026)



Password - zerowhz - 05.11.2013

fixed


Re: Password - Private200 - 05.11.2013

- Messed it up, nevermind -


Re: Password - Patrick - 05.11.2013

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


Re: Password - CrazyChoco - 05.11.2013

Is there any password listed in your ini file? Anyway, why do you guys talk about Whirlpool?

Honestly: I've never been familar with ini.


Re: Password - zerowhz - 05.11.2013

I have this one https://sampforum.blast.hk/showthread.php?tid=65290 is this the latest or ?


Re: Password - CrazyChoco - 05.11.2013

Yeah, that's the one i use atleast. But does it even save any password?


Re: Password - zerowhz - 05.11.2013

Quote:
Originally Posted by CrazyChoco
Посмотреть сообщение
Yeah, that's the one i use atleast. But does it even save any password?
Yes he save password


Re: Password - CrazyChoco - 05.11.2013

Does it show the password you entered or just a bunch of characters?


Re: Password - zerowhz - 05.11.2013

Код:
[statistics]
Password = 2F0D1903FA0D5192AADFC65819E1DA61DBB8762E73853283A820132802B2B5D44FBB29DB3EA0AA62DCE2919F2E9039765D835DE8966F1778DBDFF3B7B79A322E
Admin = 0
Kills = 0
Deaths = 0
Money = 0
but i can enter with any other password


Re: Password - CrazyChoco - 05.11.2013

Then you must look at the loading part of the password. See if you did anything wrong.