Whats Wrong?
#1

Hello,
pawn Код:
new n[MAX_PLAYER_NAME],file[256];
    if(dialogid == DIALOG_REGISTER)
    {
    format(file,sizeof(file),"LSTDM/Users/%s.txt",n);

        if(response == 0)
        {
        Kick(playerid);
        }
        if(response == 1)
        {
            new
            buf[145];

            WP_Hash(buf, sizeof (buf), inputtext);
            if (strlen(inputtext) == 0 || strlen(inputtext) < 4)
            {
                SendClientMessage(playerid,-1,"Your Password Must Have Atleast 4 Digits!");
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,""COL_GREEN"[LSTDM]",""COL_RED"This Account Was Not Found In our Database!\n"COL_YELLOW"Kindly, Type Your Desired Password Below To Register!","Register","Cancel");
                return 0;
            }
            dini_Create(file);
            dini_Set(file,"Password",buf);
            dini_IntSet(file,"Regged",1);
            dini_IntSet(file,"Logged",0);
            dini_IntSet(file,"Level",0);
            dini_IntSet(file,"Score",0);
            dini_IntSet(file,"Money",0);
            dini_IntSet(file,"Rank",0);
            dini_IntSet(file,"Reputation",0);
            dini_IntSet(file, "Kills",0);
            dini_IntSet(file, "Deaths",0);
            SendClientMessage(playerid,-1,""COL_GREEN"[LSTDM]:"COL_WHITE"Congratulations, You Have Registered!, And Have Been Logged In!");
            new pname[146],string[146];
            GetPlayerName(playerid,pname,146);
            format(string,sizeof(string),""COL_GREEN"[LSTDM]:"COL_WHITE"%s Have Registered With Our Server! And Have Been Logged In!",pname);
            SendClientMessageToAll(-1,string);
            PInfo[playerid][Regged] = 1;
            PInfo[playerid][Logged] = 1;
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
    format(file,sizeof(file),"LSTDM/Users/%s.txt",n);

        if(response == 0)
        {
            Kick(playerid);
        }
        if(response == 1)
        {

            if(strlen(inputtext) == 0)
            {
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,""COL_GREEN"[LSTDM]",""COL_GREEN"This Account Is Registered!\n"COL_YELLOW"Kindly, Input The Password Below To Login!","Login","Cancel");
            }

            new buf[145];
            WP_Hash(buf, sizeof(buf), inputtext);
            if(strcmp(buf, dini_Get(file, "Password"), false) == 0)
            {
                dini_IntSet(file,"Logged",1);
                PInfo[playerid][Rank] = dini_Int(file,"Rank");
                PInfo[playerid][Rep] = dini_Int(file,"Reputation");
                PInfo[playerid][Logged] = 1;
                PInfo[playerid][Level] = dini_Int(file,"Level");
                SetPlayerScore(playerid, dini_Int(file, "Score"));
                SetPlayerMoney(playerid, dini_Int(file, "Money"));
                PInfo[playerid][Kills] = dini_Int(file,"Kills");
                PInfo[playerid][Deaths] = dini_Int(file,"Deaths");
                SendClientMessage(playerid,-1,""COL_GREEN"[LSTDM]: "COL_WHITE"You Have Successfuly Logged In!");
                new pname[146],string[146];
                GetPlayerName(playerid,pname,sizeof(pname));
                format(string,sizeof(string),""COL_GREEN"[LSTDM]:"COL_WHITE"%s Have Successfuly Logged In!",pname);
                SendClientMessageToAll(-1,string);
            }
            else
            {
                SendClientMessage(playerid,-1,""COL_RED"[LSTDM]:"COL_WHITE"Wrong Password!");
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,""COL_RED"[LSTDM]",""COL_GREEN"This Account Is Registered!\n"COL_YELLOW"Kindly, Input The Password Below To Login!","Login","Cancel");
                return 0;
            }
        }
    }
Whats wrong with this code? when i register and/or login In-Game, even with wrong password it says you are logged in....
Thank you.
Reply
#2

-Bump...
No one can help me with it?
Reply
#3

I had to use this function...Was doing the same thing to me

pawn Код:
stock CheckPass(file[],password[])
{
    new buffer[129];
    WP_Hash(buffer, sizeof(buffer), password);
    if(strcmp(dini_Get(file,"Password"), buffer) == 0) return true;
    return false;
}
Made by MadeMan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)