Login problem -
newbienoob - 08.06.2012
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
Re: Login problem -
newbienoob - 10.06.2012
*48 hours later..*
Re: Login problem -
Dodo9655 - 10.06.2012
Try this, it works for me and I also use Whirlpool:
pawn Код:
if(!strcmp(hpass, pInfo[playerid][Pass], false, 129))
Re: Login problem -
JaKe Elite - 10.06.2012
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]?
Re: Login problem -
newbienoob - 10.06.2012
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;
}
}
}
Re: Login problem -
Littlehelper - 10.06.2012
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[])
Re: Login problem -
newbienoob - 10.06.2012
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;
}
}
}
Re : Login problem -
ricardo178 - 10.06.2012
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.
Re: Login problem -
Littlehelper - 10.06.2012
Weird, that happened to be one time when i was using return 0; at the end of OnDialogResponse.
try changing it?
Re: Login problem -
newbienoob - 10.06.2012
@ricardo178 I'm using Whirlpool.
@Littlehelper[MDZ] It always return 1;
Can someone help me?!
Re: Login problem -
newbienoob - 10.06.2012
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]"
Re: Login problem -
Forman - 12.06.2012
Can you help me via MSN or something?