SA-MP Forums Archive
Checking if it old/exist password - 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: Checking if it old/exist password (/showthread.php?tid=308043)



Checking if it old/exist password - [SP]Mr.Kakashi[WP] - 02.01.2012

i was making my Roleplay server suddenly i didn't notice that i haven't made this checking system
yet. the question is how to check if player type an old password or exists password. i'm new
in dini scripting you know

pawn Код:
new ChangePass[MAX_PLAYERS];

CMD:changepass(playerid, params[])
{
    if(ChangePass[playerid] == 0)
    {
       ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_PASSWORD, "Change Password", ""white"Please type your new "red"password "white"below", "Change","Cancel");
       ChangePass[playerid] = 1;
    }
    else return SendClientMessage(playerid, COLOR_RED, "You can only change password once at a time");
    return 1;
}

//OnDialogResponse

    if(dialogid == DIALOG_CHANGEPASS)
    {
        new name[MAX_PLAYER_NAME],file[256],string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVERFILE, name);
        if(!response) return GameTextForPlayer(playerid,"~r~Changing Password Canceled...", 1500, 3);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_PASSWORD,""red"Changing Password Failed",""red"You put a empty pass in the blank\n"green"Please make sure you field the blank\nwith your new password","Change","Cancel");
        format(string, 128, "You succesfully change your password, your new password is %s",inputtext);
        SendClientMessage(playerid, COLOR_GREEN, string);
        dini_IntSet(file, "Password", udb_hash(inputtext));
    }
+Rep for the one who will help me


Re: Checking if it old/exist password - Ballu Miaa - 02.01.2012

It should be an if(udb_hash(inputtext) == dini_Int(file,"Password")) // OldPassword can be the string you were using for password. It should be edited!


Re: Checking if it old/exist password - [SP]Mr.Kakashi[WP] - 02.01.2012

i will put it inside the Changepassword - OnDialogResponse?


Re: Checking if it old/exist password - Ballu Miaa - 02.01.2012

Quote:
Originally Posted by [SP]Mr.Kakashi[WP]
Посмотреть сообщение
i will put it inside the Changepassword - OnDialogResponse?

pawn Код:
if(dialogid == DIALOG_CHANGEPASS)
    {
        new name[MAX_PLAYER_NAME],file[256],string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVERFILE, name);
        if(!response) return GameTextForPlayer(playerid,"~r~Changing Password Canceled...", 1500, 3);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_PASSWORD,""red"Changing Password Failed",""red"You put a empty pass in the blank\n"green"Please make sure you field the blank\nwith your new password","Change","Cancel");
        if(inputtext == dini_Int(file,"Password")) return SendClientMessage(playerid,red,"You cannot keep the same password again!");
        format(string, 128, "You succesfully change your password, your new password is %s",inputtext);
        SendClientMessage(playerid, COLOR_GREEN, string);
        dini_IntSet(file, "Password", udb_hash(inputtext));
    }
[Untested]


Re: Checking if it old/exist password - [SP]Mr.Kakashi[WP] - 02.01.2012

Please also help me with my gamemode. my gamemode don't read the include anymore i got the "cannot read from file "blahblahblah" i'm sure i have all includes. the includes are working last time ago.


Re: Checking if it old/exist password - Ballu Miaa - 02.01.2012

Quote:
Originally Posted by [SP]Mr.Kakashi[WP]
Посмотреть сообщение
Please also help me with my gamemode. my gamemode don't read the include anymore i got the "cannot read from file "blahblahblah" i'm sure i have all includes. the includes are working last time ago.
Even i've got that thing lot of time's! Maybe its due to corruption in the Windows! or something else! Even i had all the necessary include's but still had that error on Compilation. What i did was Format my Windows lol.

Idk what you should do! I hope someone has a better alternative!


Re: Checking if it old/exist password - [SP]Mr.Kakashi[WP] - 02.01.2012

now i had 2 problems how could i test the code if my gamemode .amx is missing because of the error


Re: Checking if it old/exist password - [SP]Mr.Kakashi[WP] - 02.01.2012

Problem fix i copy the folder Pawno into my other server script thats why i get error i replace it now i don't have error by the way i will check if its working


Re: Checking if it old/exist password - [SP]Mr.Kakashi[WP] - 02.01.2012

Thanks it worked +Rep for you


Re: Checking if it old/exist password - Ballu Miaa - 02.01.2012

EDIT: Worked! Thread Resolved