Y_Ini - /ChangePass - 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: Y_Ini - /ChangePass (
/showthread.php?tid=253043)
Y_Ini - /ChangePass -
Riddick94 - 04.05.2011
Hi i've modified Zh3ro command /changepass from his script for my and i've got a problem.. a problem is i'm hashing a player password with Whirpool when player register.
pawn Код:
CMD:changepass(playerid, params[])
{
new NewPass[129], OldPass[129];
if(sscanf(params, "s[129]s[129]", OldPass, NewPass))return SendClientMessage(playerid, COLOR_WHITE, "* Wpisz: /changepass [OLD] [NEW]");
INI_ParseFile(PlayerFile(playerid), "GetPlayerPassword", false, true, playerid);
new Password[129];
GetPVarString(playerid, "pPass", Password, 129);
if(strcmp(Password, OldPass, false) != 0)return SendClientMessage(playerid, COLOR_RED, "* Hasło, ktуre wpisałeś nie pasuje do aktualnego.");
if(strlen(NewPass) < 5 || strlen(NewPass) > 20)return SendClientMessage(playerid, COLOR_RED, "* Hasło nie może być krуtsze niż pięć znakуw, ani dłuższe niż 20.");
SendFormattedMessage(playerid, COLOR_GREEN, "* Zmieniłeś stare hasło na nowe: %s", NewPass);
new INI:Account = INI_Open(PlayerFile(playerid));
INI_WriteString(Account, "Old_Password", OldPass);
INI_WriteString(Account, "Password", NewPass);
INI_Close(Account);
return true;
}
It's sending me a "SendClientMessage(playerid, COLOR_RED, "* Hasło, ktуre wpisałeś nie pasuje do aktualnego.");" it mean i've entered a bad password to change. I need to get hashed password but don't know how to do that and hash a new one. Anyone please?
Re: Y_Ini - /ChangePass -
Zh3r0 - 04.05.2011
pawn Код:
new buf[129];
WP_Hash( buf, (129), NewPass );
INI_WriteString(Account,"Password",buf);
Re: Y_Ini - /ChangePass -
Riddick94 - 04.05.2011
Okey but what with that?
pawn Код:
if(strcmp(Password, OldPass, false) != 0)return SendClientMessage(playerid, COLOR_RED, "* Hasło, ktуre wpisałeś nie pasuje do aktualnego.");
ENG:
The password what you entered is not correct with your current password.
Re: Y_Ini - /ChangePass -
Zh3r0 - 04.05.2011
Hash both passwords.
Re: Y_Ini - /ChangePass -
Riddick94 - 04.05.2011
pawn Код:
CMD:changepass(playerid, params[])
{
new NewPass[129], OldPass[129], buf[129], buf2[129];
WP_Hash(buf, sizeof(buf), NewPass);
WP_Hash(buf2, sizeof(buf2), OldPass);
if(sscanf(params, "s[129]s[129]", OldPass, NewPass))return SendClientMessage(playerid, COLOR_WHITE, "* Wpisz: /changepass [OLD] [NEW]");
INI_ParseFile(PlayerFile(playerid), "GetPlayerPassword", false, true, playerid);
new Password[129];
GetPVarString(playerid, "pPass", Password, 129);
if(strcmp(Password, buf2, false) != 0)return SendClientMessage(playerid, COLOR_RED, "* Hasło, ktуre wpisałeś nie pasuje do aktualnego.");
if(strlen(NewPass) < 5 || strlen(NewPass) > 20)return SendClientMessage(playerid, COLOR_RED, "* Hasło nie może być krуtsze niż pięć znakуw, ani dłuższe niż 20.");
SendFormattedMessage(playerid, COLOR_GREEN, "* Zmieniłeś stare hasło na nowe: %s", NewPass);
new INI:Account = INI_Open(PlayerFile(playerid));
INI_WriteString(Account, "Old_Password", buf2);
//INI_WriteString(Account, "Password", NewPass);
INI_WriteString(Account, "Password", buf);
INI_Close(Account);
return true;
}
Like that?
Re: Y_Ini - /ChangePass -
Riddick94 - 04.05.2011
Finally working. Thanks to you two