case DLG_LOGIN:
{
if(response == 1)
{
new encpass[129],stored[129];
GetPlayerName(playerid,pName,sizeof(pName));
format(pFile,sizeof(pFile),"Users/%s.txt",pName);
DOF2_GetStringEx(pFile,"password",stored,sizeof(stored));
WP_Hash(encpass,sizeof(encpass),inputtext);
if(strcmp(stored, inputtext,true) && strcmp(stored, encpass, true))
{
ShowPlayerDialog(playerid,DLG_LOGIN,DIALOG_STYLE_PASSWORD,"Galaxy RPG - Login","You entered your password incorrectly.\nPlease enter your password to login:","Login","Cancel");
return 1;
}
else
{
LoadPlayerStats(playerid);
return 1;
}
}
if(response == 0)
{
ShowPlayerDialog(playerid,DLG_LOGREGQUIT,0,"Quit","You have cancelled your login.","Ok","");
Kick(playerid);
return 1;
}
}
case DLG_LOGIN:
{
if(response == 1)
{
new encpass[129],stored[129];
GetPlayerName(playerid,pName,sizeof(pName));
format(pFile,sizeof(pFile),"Users/%s.txt",pName);
DOF2_GetStringEx(pFile,"password",stored,sizeof(stored));
WP_Hash(encpass,sizeof(encpass),inputtext);
if(!strcmp(encpass,stored))
{
LoadPlayerStats(playerid);
return 1;
}
else
{
ShowPlayerDialog(playerid,DLG_LOGIN,DIALOG_STYLE_PASSWORD,"Galaxy RPG - Login","You entered your password incorrectly.\nPlease enter your password to login:","Login","Cancel");
return 1;
}
}
if(response == 0)
{
ShowPlayerDialog(playerid,DLG_LOGREGQUIT,0,"Quit","You have cancelled your login.","Ok","");
Kick(playerid);
return 1;
}
}
case DLG_LOGIN:
{
if(response == 1)
{
new encpass[129],stored[129];
GetPlayerName(playerid,pName,sizeof(pName));
format(pFile,sizeof(pFile),"Users/%s.txt",pName);
DOF2_GetStringEx(pFile,"password",stored,sizeof(stored));
WP_Hash(encpass,sizeof(encpass),inputtext);
if(!strcmp(encpass,stored))
{
LoadPlayerStats(playerid);
}
else
{
ShowPlayerDialog(playerid,DLG_LOGIN,DIALOG_STYLE_PASSWORD,"Galaxy RPG - Login","You entered your password incorrectly.\nPlease enter your password to login:","Login","Cancel");
}
}
if(response == 0)
{
ShowPlayerDialog(playerid,DLG_LOGREGQUIT,0,"Quit","You have cancelled your login.","Ok","");
Kick(playerid);
}
}
#Update#: Is there any reason why you are using an array with the size of 129?
|
Originally Posted by ******@ Whirlpool Thread
To use simply call the function, passing a buffer of at least 129 characters, the size of that buffer and the string you want to hash. This used to say 145 but I have no idea why! You need 128 for the hash and 1 for the NULL terminator
|
#Update#: Is there any reason why you are using an array with the size of 129?
I quote Whirlpool plugin thread: Anyway back to the topic here - Try checking if it get called twice (debug prints.) |