/changepassword
#1

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

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
Reply
#3

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.
Reply
#4

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");
}
Reply
#5

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.
Reply
#6

Mr. Iknowitall.

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

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 ^^
Reply
#8

BUMP.
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)