log in bug
#1

Hello, im having a bug with my login system. The registration dialog works fine creates the files and contents etc but when going back into the server and having to login it Always says its wrong password

Here is my dialogs(register/login)
pawn Код:
if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 1;
            }
            new hashpass[129];
            new year, month, day, string[128];
            new pname[MAX_PLAYER_NAME], path[200];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(path, sizeof(path), "/Sfcnr/Users/%s.ini", pname);
            getdate(year, month, day);
            format(string, sizeof(string), "%02d/%02d/%d", day, month, year);
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            dini_Create(path);
            dini_Set(path,"Ppassword",hashpass);
            dini_Set(path, "Username", PlayerName(playerid));
            dini_IntSet(path, "Score", 0);
            dini_IntSet(path, "Money", 0);
            dini_IntSet(path, "Bank_Money", 0);
            dini_IntSet(path, "Stat", 0);
            dini_IntSet(path, "Swat", 0);
            dini_IntSet(path, "Army", 0);
            dini_IntSet(path, "Admin_Level", 0);
            dini_IntSet(path, "Cop_Level", 0);
            dini_Set(path, "Register_date", string);
            dini_IntSet(path, "Prison", 0);
            dini_IntSet(path, "Vip_level", 0);
            dini_IntSet(path, "Arrest_Level", 0);
            dini_IntSet(path, "Taze_Level", 0);
            dini_IntSet(path, "Rob_Level", 0);
            dini_IntSet(path, "Rape_Level", 0);
            dini_IntSet(path, "Heal_Level", 0);
            dini_IntSet(path, "Hitman_Level", 0);
            dini_IntSet(path, "Sales_Level", 0);
            dini_IntSet(path, "Weapon_Level", 0);
            dini_IntSet(path, "Drug_Level", 0);
            dini_IntSet(path, "Trucking_Level", 0);
            SendClientMessage(playerid,COLOR_GREEN,"You have been successfully registered");
        }
    }
    if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(strcmp(hashpass,PlayerInfo[playerid][Ppassword]))
            {
                SetPlayerScore(playerid, dini_Int(Path(playerid), "Score"));
                GivePlayerMoney(playerid,dini_Int(Path(playerid), "Money"));
                SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
                return 1;
            }
            else if(!strcmp(hashpass,PlayerInfo[playerid][Ppassword]))
            {
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
                return 1;
            }
        }
    }
Im using dini.
Reply
#2

I think its due of hash pass, try without the hash if you DONT know how to use a hash system
Reply
#3

Try
pawn Код:
if(strcmp(PlayerInfo[playerid][Ppassword], inputtext) == 0))
On the login part.
Reply
#4

Got 3 errors
Код:
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(2181) : error 029: invalid expression, assumed zero
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(2188) : warning 225: unreachable code
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(2188) : error 029: invalid expression, assumed zero
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(2188) : warning 215: expression has no effect
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(2188) : error 001: expected token: ";", but found "if"
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(3056) : warning 203: symbol is never used: "HouseExit"
C:\Users\iphone\Desktop\SFCNR\gamemodes\Sfcnr.pwn(3056) : warning 203: symbol is never used: "PlayerInHouseID"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#5

You're using strcmp wrong. It returns 0 when the two strings match.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)