/changepass doesn't work
#1

pawn Код:
dcmd_changepass(playerid, params[])
{
    new name[MAX_PLAYER_NAME], buf[150], newpass[30];
    GetPlayerName(playerid, name, sizeof(name));
    if(sscanf(params,"s", newpass)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /changepass [new password]");
    if(strlen(params) >= 3)
    {
        format(file, sizeof(file), "users/%s.txt", name);
        newpass[playerid] = udb_hash(buf); // here is where I get the error
        dini_Set(file, "Password", newpass);
        SendClientMessage(playerid, COLOUR_GREEN, "Your password has been successfully been changed");
    }
    else
    {
        SendClientMessage(playerid, COLOUR_RED, "Your password must be atleast 3 characters long");
    }
    return 1;
}
Everything works perfectly, returns now error, but the one thing is... That password doesn't change. Anyone got any suggestions?
Reply
#2

Are you sure that you are deleting the old password beforehand via script?
Reply
#3

Quote:
Originally Posted by nmader
Посмотреть сообщение
Are you sure that you are deleting the old password beforehand via script?
So you mean that I have to go into the file and delete the old password everytime I use the command? Don't want to be rude, but the meaning with this command is that I won't have to do this. Or have I misunderstood you?
Reply
#4

Well, I was asking if the script will delete the old password, rather than try to write a new line to your .ini file.
Reply
#5

Oh, I see! I don't really know. Maybe I have to use the dini_Remove function before this? I am not that good with dini, but I am trying to learn it now
Reply
#6

Dolph do you play on SkR clan?
Reply
#7

Quote:
Originally Posted by Bogdan1992
Посмотреть сообщение
Dolph do you play on SkR clan?
Yes indeed, Bogdan
Reply
#8

Ok try this.
PHP код:
dcmd_changepass(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME], newpass[30];
    
GetPlayerName(playeridnamesizeof(name));
    if(
sscanf(params,"s"newpass)) return SendClientMessage(playerid0xF60000AA"USAGE: /changepass [new password]");
    if(
strlen(params) >= 3)
    {
        
format(filesizeof(file), "users/%s.txt"name);
        
dini_Set(file"Password"udb_hash(newpass));
        
SendClientMessage(playeridCOLOUR_GREEN"Your password has been successfully been changed");
    }
    else
    {
        
SendClientMessage(playeridCOLOUR_RED"Your password must be atleast 3 characters long");
    }
    return 
1;

Reply
#9

Got errors, so I went to the version I had. Hmm, still can't figure out why it won't work.
Reply
#10

What errors?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)