Need /Changepass Cmd
#1

Hi,
I Need To Know How To Create /Changepass Cmd
I Want It In:
(1)YCMD
(2)Sscanf
(3)YINI

My Variables
pawn Код:
enum gPInfo
    {
            Logged,
            Regged,
            Pass[129],
            Adminlevel,
            VIPlevel,
            freeze,
            mute,
            spawn,
            Money,
            Scores,
            sam,
            jail,
            AFK,
            warn,
            uvh,
            Kills,
            Deaths

    };
Thanks
Reply
#2

Post it here https://sampforum.blast.hk/showthread.php?tid=187229
Reply
#3

No One Want To Answer In The Script Request Can Any One Please Help Me Here
Reply
#4

Ontop of your script.
pawn Код:
enum pInfo
{
     pPassword
}
new PlayerInfo[playerid][pInfo];
Now, the command

pawn Код:
COMMAND:changepass(playerid, params[))
{
    new newpass;
    if(!sscanf(params, "s", newpass))
    {
        // Open his file here, edit the Password, close the file, done.
    }
    return 1;
}
I expect you know how to use YSI\Y_ini well.
Reply
#5

EDITED

I Fixed The Errors And The Warnings But When I Use The Cmd It Say The Oldpass Is Incorrect And I Type The Correct Pass

pawn Код:
YCMD:changepass(playerid, params[], help)
            {
            new string[200],newpass[200],oldpass[200],oldhashpass[200],newhashpass[200];
            WP_Hash(newhashpass,sizeof(newhashpass),newpass);
            WP_Hash(oldhashpass,sizeof(oldhashpass),oldpass);
            if(sscanf(params,"s[128]s[128]",oldpass,newpass)) return SendClientMessage(playerid,RED,"USAGE:/ChangePass [OldPass] [Newpass]");
            if(strcmp(oldhashpass,PInfo[playerid][Pass])) return SendClientMessage(playerid,RED,"The Old Password Is Incorrect");
            format(string,sizeof(string),"You Have Changed Your Password From {FF0000}%s {008000}To {FF0000}%s",oldpass,newpass);
            SendClientMessage(playerid,GREEN,string);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Data");
            INI_WriteString(file,"Password",newhashpass);
            INI_Close(file);
            return 1;
   }
Reply
#6

Any One Please
Reply
#7

You hash the password before you get it out the params with sscanf
Reply
#8

I Triad To Hash The Password Under
pawn Код:
new INI:file = INI_Open(Path(playerid));
It Changed My Password But When I Write The Old Password Wrong It Change It Too
Reply
#9

You have to hash it inbetween it being assigned to a variable and the password being compared to the previously saved password hash.

In short: You have to has it inbetween the "sscanf" and "strcmp"
Reply
#10

That What I Did In The First And When I Type The Password It Say The Old Password Is Incorrect
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)