SA-MP Forums Archive
/changepassword - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /changepassword (/showthread.php?tid=260688)



/changepassword - Face9000 - 10.06.2011

Hi guys,someone can give me some help to code the /changepassword command?Thanks.


Re: /changepassword - PGTips - 10.06.2011

easy we need to know how your saving your passwords though so we can put it under DINI or Y_INI DJASON

also post the line and tell us if your encoding your passwords so we can keep the encoding

EDIT: then you make the command /change password

save it

Changed!

if you dont undersatnd still post


Re: /changepassword - r3k1lLz_ - 10.06.2011

You basicly change the password line using DINI or whatever I'm sure there's a command, if not delete the current line and create a new one with the new param.


Re: /changepassword - ColdIce - 10.06.2011

I am a newbie but I like to try to help people! Correct me if I am wrong about this

pawn Код:
dcmd_CMD_CHANGEPASS(playerid,params[])
{
    if(AccInfo[playerid][LoggedIn] == 1)
    {
        if(!strlen(params)) return
        SendClientMessage(playerid, LIGHTBLUE2, "Usage: /"#ChangePassCommand" [NewPassword]")
        && SendClientMessage(playerid, orange, "Function: Will modify your account password");
        if(strlen(params) < 4) return SendClientMessage(playerid,red,"ERROR: Incorrect password length!");
        new string[128];
        new file[128], Pass[256];
        format(file,sizeof(file),"/YOURADMINSCRIPT/Accounts/%s.sav",udb_encode(PlayerName2(playerid)) );
        new buf[145];
        WP_Hash(buf, sizeof(buf), params);
        Pass = dini_Get(file, "Password");
        dini_Set(file, "Password", buf);
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"|- You have successfully changed your account Password to \"%s\" -|",params);
        return SendClientMessage(playerid,yellow,string);
    } else return SendClientMessage(playerid,red, "ERROR: You must have an account to use this command");
}



Re: /changepassword - alpha500delta - 10.06.2011

Quote:
Originally Posted by ColdIce
Посмотреть сообщение
I am a newbie but I like to try to help people! Correct me if I am wrong about this

pawn Код:
dcmd_CMD_CHANGEPASS(playerid,params[])
{
    if(AccInfo[playerid][LoggedIn] == 1)
    {
        if(!strlen(params)) return
        SendClientMessage(playerid, LIGHTBLUE2, "Usage: /"#ChangePassCommand" [NewPassword]")
        && SendClientMessage(playerid, orange, "Function: Will modify your account password");
        if(strlen(params) < 4) return SendClientMessage(playerid,red,"ERROR: Incorrect password length!");
        new string[128];
        new file[128], Pass[256];
        format(file,sizeof(file),"/YOURADMINSCRIPT/Accounts/%s.sav",udb_encode(PlayerName2(playerid)) );
        new buf[145];
        WP_Hash(buf, sizeof(buf), params);
        Pass = dini_Get(file, "Password");
        dini_Set(file, "Password", buf);
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"|- You have successfully changed your account Password to \"%s\" -|",params);
        return SendClientMessage(playerid,yellow,string);
    } else return SendClientMessage(playerid,red, "ERROR: You must have an account to use this command");
}
Ehm...

- Pass is like 42, not 256
- You forgot some ;'s
- You used # somewhere
- you did return instead of return 1;

Please COMPILE your code before you post it.

__________________________________________________ ______________________________________________

For the question, please post your saving system like stated above... Or your script(or a part) so we can help you.


Re: /changepassword - ColdIce - 10.06.2011

Mr. Iknowitall.

This is taken from LuxAdmin, I had nothing to do with this. And let me assure you, it compiles juuuust fine!


Re: /changepassword - Face9000 - 10.06.2011

I use dini,this is how i save and hash password's on /register command:

pawn Код:
dini_IntSet(udb_encode(playername), "password", udb_hash(inputtext));
Thanks for help ^^


Re: /changepassword - Face9000 - 11.06.2011

BUMP.


Re: /changepassword - berz - 11.06.2011

Here, i hope it will help You.
pawn Код:
if(strcmp(cmd, "/changepass", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to login first.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   This feature is comming up on next release");
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changepass[password]");
                return 1;
            }
            strmid(PlayerInfo[playerid][pKey], tmp, 0, strlen(cmdtext), 255);
            OnPlayerUpdate(playerid);
            SendClientMessage(playerid, COLOR_YELLOW, "   Password has been changed successfuly");
        }
        return 1;
    }