if( response )
{
new string1[30];
if(udb_hash(inputtext) == PlayerInfo[playerid][PASSWORD])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][MONEY]);
}
else
{
DeletePVar(playerid, "FailedLoginAttempt");
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", string1, "Login", "Cancel");
}
else //HERE--------------
{
if(GetPVarInt(playerid, "FailedLoginAttempt") == 0)
{
SetPVarInt(playerid, "FailedLoginAttempt", 1);
SendClientMessage(playerid, -1, "SERVER: asdasdsad.");
}
else if(GetPVarInt(playerid, "FailedLoginAttempt") == 1)
{
SetPVarInt(playerid, "FailedLoginAttempt", 2);
SendClientMessage(playerid, -1, "SERVER: sadsad.");
}
else if(GetPVarInt(playerid, "FailedLoginAttempt") == 2)
{
SetPVarInt(playerid, "FailedLoginAttempt", 3);
SendClientMessage(playerid, -1, "SERVER: asdsad.");
}
else if(GetPVarInt(playerid, "FailedLoginAttempt") == 3)
{
DeletePVar(playerid, "FailedLoginAttempt");
SendClientMessage(playerid, -1, "SERVER: asdasd.");
Kick(playerid);
}
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", string1, "Login", "Cancel");
}
}
}
}
return 1;
}
|
if(udb_hash(inputtext) == PlayerInfo[playerid][PASSWORD]) |
if(udb_hash(inputtext) == PlayerInfo[playerid][PASSWORD])
{
// PASSWORD CORRECT
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][MONEY]);
}
else
{
// WRONG PASSWORD
if(GetPVarInt(playerid, "FailedLoginAttempt") == 0)
{
SetPVarInt(playerid, "FailedLoginAttempt", 1);
SendClientMessage(playerid, -1, "SERVER: Password wrong.");
}
else if(GetPVarInt(playerid, "FailedLoginAttempt") == 1)
{
SetPVarInt(playerid, "FailedLoginAttempt", 2);
SendClientMessage(playerid, -1, "SERVER: Password wrong.");
}
else if(GetPVarInt(playerid, "FailedLoginAttempt") == 2)
{
SetPVarInt(playerid, "FailedLoginAttempt", 3);
SendClientMessage(playerid, -1, "SERVER: Password wrong.");
}
else if(GetPVarInt(playerid, "FailedLoginAttempt") == 3)
{
DeletePVar(playerid, "FailedLoginAttempt");
SendClientMessage(playerid, -1, "SERVER: asdasd.");
Kick(playerid);
}
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your password", "Login", "Cancel");
}
if(!strcmp(udb_hash(inputtext), PlayerInfo[playerid][PASSWORD], true)) {
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][MONEY]);
} else {
new fla = GetPVarInt(playerid, "FailedLoginAttempt");
if(fla == 3) {
SendClientMessage(playerid, -1, "SERVER: asdasd");
Kick(playerid);
return 1;
} else {
SetPVarInt(playerid, "FailedLoginAttempt", fla + 1);
SendClientMessage(playerid, -1, "SERVER: Password wrong.");
}
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your password", "Login", "Cancel");
}
|
I don't know why people check the same variable for different values if it's always the same outcome... it's a waste of coding time + lines.
|
|
if(PlayerInfo[playerid][pFaction] == PlayerInfo[playerid][pFaction])
|
if(!response)
{
SendClientMessage(playerid, -1, "You have been kicked out of the server because you failed to respond!");
Kick(playerid);
}
if(!IsValidPassword(inputtext))
{
new string1[30];
SendClientMessage(playerid, -1, "SERVER: The password you entered is invalid" );
return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", string1, "Register", "Cancel");
}
if(strlen(inputtext) < 6 || strlen(inputtext) > 24)
{
new string1[30];
SendClientMessage(playerid, -1, "SERVER: The password you entered is invalid. The length of the password should be between 6-24 characters" );
return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", string1, "Register", "Cancel");
}
if(response)
{
new string1[30];
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Register", string1, "Register", "Cancel");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Kills",0);
INI_Close(File);
}
}
|
as i know you have to check
if(strlen(inputtext) < 6 || strlen(inputtext) > 24) in if(response) statement your code is so mixed up dude |
I did try it as far and i'm confused too 