My changepass command is not working. Would need some help please.
#1

Hi, im trying to fix my changepass command but dont get what is wrong with it. Some help would be really appreciated.

pawn Код:
CMD:changepass(playerid, params[])
{
    new pass[129], newpass[129], hashpass[129];
    if(!Info[playerid][Logged]) return SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in.");
    if(sscanf(params, "s[129]s[129]", params, newpass)) return SendClientMessage(playerid, COLOR_RED, "Usage: /changepass [Old Password] [New Password]");
    if(strlen(newpass) < 3 || strlen(newpass) > 24) return SendClientMessage(playerid, COLOR_RED, "Incorrect Password Length. Please choose a password between 4 and 20 characters.");
    WP_Hash(hashpass,sizeof(hashpass), params);
    if(!strcmp(hashpass, Info[playerid][Password]))
    {
        WP_Hash(pass, sizeof(pass), newpass);
        new INI:File = INI_Open(UserPath(playerid ));
        INI_SetTag(File, "Player Data");
        INI_WriteString(File, "Password", pass);
        INI_Close(File);
        SendClientMessageFormatted(playerid, COLOR_RED, "You have sucessfuly changed your password to '%s'.", newpass);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You have entered an incorrect password. Please try again.");
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)