[GUI] Register & Login
#1

Well it creates the account successfully with everything set correct, but it always gives a wrong password message on login. Any suggestions?

id 1: Registering
id 2: Logging in

pawn Код:
if(dialogid == 1)
    {
        new file[128];
        new message[128];
        format(file, sizeof(file), "%s.ini", ReturnPlayerName(playerid));
        dini_Create(file);
        dini_Set(file, "name", ReturnPlayerName(playerid));
        dini_IntSet(file, "hashPW", udb_hash(inputtext));
        dini_Set(file, "password", inputtext);
        dini_IntSet(file, "admlvl", 0);
        dini_IntSet(file, "money", 0);
        dini_IntSet(file, "clan", PlayerInfo[playerid][pClan]);
        dini_IntSet(file, "clanleader", PlayerInfo[playerid][pClanLeader]);
        format(message, sizeof(message), "SERVER: You have successfully registered your account, password: %s", inputtext);
        SendClientMessage(playerid, COLOR_WHITE, message);
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT , "Welcome to RV-RP DM", "Please login using your password", "Confirm", "Cancel");
    }
    else if(dialogid == 2)
    {
        new file[128];
        new password[256];
        new message[128];
        new spassword[255];
        strmid(spassword, inputtext, 0, strlen(inputtext), 255);
        format(file, sizeof(file), "%s.ini", ReturnPlayerName(playerid));
        spassword = dini_Get(file, "hashPW");
        if(udb_hash(password) != strval(spassword))
        {
            format(message, sizeof(message), "SERVER: Invalid password.");
            SendClientMessage(playerid, COLOR_WHITE, message);
        }
        else
        {
            PlayerInfo[playerid][pLogged] = 1;
            PlayerInfo[playerid][pAdmin] = dini_Int(file, "admlvl");
            PlayerInfo[playerid][pMoney] = dini_Int(file, "money");
            PlayerInfo[playerid][pClanLeader] = dini_Int(file, "clanleader");
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
            PlayerInfo[playerid][pName] = ReturnPlayerName(playerid);
            format(message, sizeof(message), "SERVER: Welcome to the server, %s.", ReturnPlayerName(playerid));
            SendClientMessage(playerid, COLOR_WHITE, message);
        }
    }
Reply
#2

Too many arrays idk for what
pawn Код:
else if(dialogid == 2)
    {
        new file[30];
        new str[255];
        format(file, sizeof(file), "%s.ini", ReturnPlayerName(playerid));
        str = dini_Get(file, "hashPW");
        if(udb_hash(inputtext) == strval(str))
        {
            PlayerInfo[playerid][pLogged] = 1;
            PlayerInfo[playerid][pAdmin] = dini_Int(file, "admlvl");
            PlayerInfo[playerid][pMoney] = dini_Int(file, "money");
            PlayerInfo[playerid][pClanLeader] = dini_Int(file, "clanleader");
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
            PlayerInfo[playerid][pName] = ReturnPlayerName(playerid);
            format(str, sizeof(str), "SERVER: Welcome to the server, %s.", ReturnPlayerName(playerid));
            SendClientMessage(playerid, COLOR_WHITE, str);
        }else{
            format(str,26,"SERVER: Invalid password.");
            SendClientMessage(playerid, COLOR_WHITE, str);
        }
    }
try that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)