SA-MP Forums Archive
Need /Changepass Cmd - 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)
+--- Thread: Need /Changepass Cmd (/showthread.php?tid=360260)



Need /Changepass Cmd - misho1 - 17.07.2012

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


Re: Need /Changepass Cmd - StrangeLove - 17.07.2012

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


Re: Need /Changepass Cmd - misho1 - 21.07.2012

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


Re : Need /Changepass Cmd - Sandiel - 21.07.2012

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.


Re: Need /Changepass Cmd - misho1 - 22.07.2012

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;
   }



Re: Need /Changepass Cmd - misho1 - 24.07.2012

Any One Please


Re: Need /Changepass Cmd - FUNExtreme - 24.07.2012

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


Re: Need /Changepass Cmd - misho1 - 24.07.2012

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


Re: Need /Changepass Cmd - FUNExtreme - 25.07.2012

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"


Re: Need /Changepass Cmd - misho1 - 25.07.2012

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