Login problem
#1

I have a problem with YINI. I can login with any password I type.
pawn Код:
if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hpass[129];
            WP_Hash(hpass,sizeof(hpass),inputtext);
            if(!strcmp(hpass,pInfo[playerid][Pass]))
            {
                INI_ParseFile(Path(playerid),"loadaccount",true,true,playerid);
                SetPlayerScore(playerid,pInfo[playerid][DMScore]+pInfo[playerid][RaceScore]);
            }
            else
            {
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","This account is registered. \nPlease enter the password for this account to login. \nIncorrect Password!","Login","Quit");
                return 1;
            }
        }
    }
And if I remove ' ! '
pawn Код:
if(!strcmp(hpass,pInfo[playerid][Pass]))
// to
if(strcmp(hpass,pInfo[playerid][Pass]))
//I can't even login
Reply
#2

*48 hours later..*
Reply
#3

Try this, it works for me and I also use Whirlpool:
pawn Код:
if(!strcmp(hpass, pInfo[playerid][Pass], false, 129))
Reply
#4

pawn Код:
if(strcmp(hpass, pInfo[playerid][Pass], true) == 0)
the code i give above will check if player type correct pass

try if it works. are you Parsing the file before using pInfo[playerid][Pass]?
Reply
#5

Still not working.

Quote:
Originally Posted by Romel
Посмотреть сообщение
are you Parsing the file before using pInfo[playerid][Pass]?
pawn Код:
if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hpass[129];
            WP_Hash(hpass,sizeof(hpass),inputtext);
            if(strcmp(hpass, pInfo[playerid][Pass], true) == 0)
            {
                INI_ParseFile(Path(playerid),"loadaccount",.bExtra = true, .extra = playerid);
                SetPlayerScore(playerid,pInfo[playerid][DMScore]+pInfo[playerid][RaceScore]);
                SetPlayerScore(playerid,pInfo[playerid][DMScore]);
                SetPlayerScore(playerid,pInfo[playerid][RaceScore]);
            }
            else
            {
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","This account is registered. \nPlease enter the password for this account to login. \nIncorrect Password!","Login","Quit");
                return 1;
            }
        }
    }
Reply
#6

Replace
pawn Код:
INI_ParseFile(Path(playerid),"loadaccount",true,true,playerid);
with
pawn Код:
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
and public with
pawn Код:
public loadaccount_data(playerid,name[],value[])
Reply
#7

Now I can enter any password to login now :(

Under OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s",true,true,playerid);
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","This account is registered. \nPlease enter the password for this account to login","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","This account is not registered. \nPlease register by entering your own password below","Register","Quit");
        pInfo[playerid][Admin] = 0;
        pInfo[playerid][DMScore] = 0;
        pInfo[playerid][RaceScore] = 0;
    }
Under OnDialogResponse
pawn Код:
if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hpass[129];
            WP_Hash(hpass,sizeof(hpass),inputtext);
            if(strcmp(hpass, pInfo[playerid][Pass], true) == 0)
            {
                INI_ParseFile(Path(playerid),"loadaccount_%s",true,true, playerid);
                SetPlayerScore(playerid,pInfo[playerid][DMScore]+pInfo[playerid][RaceScore]);
                SetPlayerScore(playerid,pInfo[playerid][DMScore]);
                SetPlayerScore(playerid,pInfo[playerid][RaceScore]);
            }
            else
            {
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","This account is registered. \nPlease enter the password for this account to login. \nIncorrect Password!","Login","Quit");
                return 1;
            }
        }
    }
Reply
#8

I am doing like this, and it works:

pawn Код:
if(udb_hash(inputtext) == PlayerInfo[playerid][Password])
Of-course you have to change the player variable to the one you use.
Reply
#9

Weird, that happened to be one time when i was using return 0; at the end of OnDialogResponse.
try changing it?
Reply
#10

@ricardo178 I'm using Whirlpool.
@Littlehelper[MDZ] It always return 1;

Can someone help me?!
Reply
#11

EDIT: Fixed!

Use INI_String for password.
At enum
pawn Код:
enum PlayerInfo
{
    Pass[129],
//......others
};
new pInfo[MAX_PLAYERS][PlayerInfo]

//So it will be
INI_String("Password",pInfo[playerid][Pass],129);
I forgot to add "[129]"
Reply
#12

Can you help me via MSN or something?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)