/changepass command using sscanf
#1

Hello guys.
I'm making a /changepass <oldpass> <newpass> command for my user system.
I am using djson for data saving and sscanf with zcmd for multi parameter commands.
I dont have much experience with sscanf.

I did like this:
pawn Код:
COMMAND:changepass(playerid, params[])
{
    new name[MAX_PLAYER_NAME], file[128], tmp, oldpass, newpass;
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), UserFile, name);
    if(sscanf(params, "ss", oldpass, newpass)) return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /changepass <oldpass> <newpass>");
    tmp = djInt(file, "Password");
    if(udb_hash(tmp) == oldpass)
    {
        djSetInt(file, "Password", udb_hash(newpass));
        SendClientMessage(playerid, COLOR_GREEN, "( ! ) Password change successful");
    }
    else SendClientMessage(playerid, COLOR_SYSTEMRED, "( ! ) The old password you entered is incorrect");
    return 1;
}
Note: I'm using dudb to hash the password (udb_hash())

Hope you can help me. Thank you.
Reply


Messages In This Thread
/changepass command using sscanf - by sim_sima - 30.06.2011, 11:55
Re: /changepass command using sscanf - by langricr - 30.06.2011, 12:27
Re: /changepass command using sscanf - by sim_sima - 30.06.2011, 12:46
Re: /changepass command using sscanf - by langricr - 30.06.2011, 12:47
Re: /changepass command using sscanf - by sim_sima - 30.06.2011, 12:58
Re: /changepass command using sscanf - by sim_sima - 30.06.2011, 13:29
Re: /changepass command using sscanf - by playbox12 - 30.06.2011, 13:33
Re: /changepass command using sscanf - by sim_sima - 30.06.2011, 13:37

Forum Jump:


Users browsing this thread: 1 Guest(s)