SA-MP Forums Archive
who can help me please ? - 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: who can help me please ? (/showthread.php?tid=316212)



who can help me please ? - ServerScripter - 05.02.2012

hi , i have a very big big problem , and i can't progress to my server if i don't fix it, the password saving
so the password doesn't save , whene i type whatever password , it write : pw=0

The Register dialog :
pawn Код:
if(dialogid == 1) {
        new file[128], name[MAX_PLAYER_NAME], str[128];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(file, sizeof(file), "LATDM/users/%s.ini", name);
        if(response) {
            if(strlen(inputtext)) {
                dini_Create(file);
                dini_IntSet(file, "pw", num_hash(inputtext));
                dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
                dini_IntSet(file, "VipLevel", PlayerInfo[playerid][VipLevel]);
                dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
                dini_IntSet(file, "score", PlayerInfo[playerid][score]);
                format(str, sizeof(str), "You are registered as ~r~ %s. Your password is ~r~ %s. /changepass to change it", name, inputtext);
                SendClientMessage(playerid, -1, str);
                PlayerInfo[playerid][score] = dini_Int(file, "score");
                PlayerInfo[playerid][cash] = dini_Int(file, "cash");
                PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                PlayerInfo[playerid][VipLevel] = dini_Int(file, "VipLevel");
            }
        }
        else {
            Kick(playerid);
        }
    }
The login one :
pawn Код:
if(dialogid == 2) {
        new file[128], name[MAX_PLAYER_NAME], str[128];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(str, sizeof(str), "LATDM/users/%s.ini", name);
        if(response) {
            if(strlen(inputtext)) {
                if(num_hash(inputtext) != dini_Int(file, "pw")) {
                    SendClientMessage(playerid, COLOR_RED, "[Anti-Cheat]: you have typed a wrong password for this account !");
                    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
                }
                else {
                    format(str, sizeof(str), "welcome %s ! you are now logged-in to your account .", name);
                    PlayerInfo[playerid][score] = dini_Int(file, "score");
                    PlayerInfo[playerid][cash] = dini_Int(file, "cash");
                    GivePlayerMoney(playerid, dini_Int(file, "cash"));
                    SetPlayerScore(playerid, dini_Int(file, "score"));
                    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                    PlayerInfo[playerid][VipLevel] = dini_Int(file, "VipLevel");
                }
            }
        }
        else {
            Kick(playerid);
        }
    }

I HOPE YOU HELP ME



Re: who can help me please ? - Tanush123 - 05.02.2012

did it work fine when you unhashed it?


Re: who can help me please ? - ServerScripter - 05.02.2012

how to unhash ? i edited num_hash to udb_hash still not working , thank you for your reply


Re: who can help me please ? - Madd Kat - 05.02.2012

i think he meant to remove the hash and ensure your getting a value in the ini file
just use the inputtext without the hash for testing then go from there.


Re: who can help me please ? - ServerScripter - 05.02.2012

ok whene i remove "num_hash" it give me error...


Re: who can help me please ? - ServerScripter - 05.02.2012

Please just say to me what i should edite to fix this problem , thanks.


Re: who can help me please ? - Tanush123 - 06.02.2012

try changing
pawn Код:
dini_IntSet(file, "pw", num_hash(inputtext));
to
pawn Код:
dini_IntSet(file, "pw", strval(inputtext));
for dialog 1

and for dialog 2
change
pawn Код:
if(num_hash(inputtext) != dini_Int(file, "pw")) {
to
pawn Код:
if(strval(inputtext) != dini_Int(file, "pw")) {



Re: who can help me please ? - ServerScripter - 06.02.2012

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
try changing
pawn Код:
dini_IntSet(file, "pw", num_hash(inputtext));
to
pawn Код:
dini_IntSet(file, "pw", strval(inputtext));
for dialog 1

and for dialog 2
change
pawn Код:
if(num_hash(inputtext) != dini_Int(file, "pw")) {
to
pawn Код:
if(strval(inputtext) != dini_Int(file, "pw")) {
still not saving the passwords , and now whene i edite it let me to enter also if i typed a wrong pass.