Y_Ini - /ChangePass
#1

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?
Reply
#2

pawn Код:
new buf[129];
WP_Hash( buf, (129), NewPass );
INI_WriteString(Account,"Password",buf);
Reply
#3

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.
Reply
#4

Hash both passwords.
Reply
#5

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?
Reply
#6

Finally working. Thanks to you two
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)