Fixed -
MWF2 - 14.07.2010
I Finally fixed the problems I was asking for before.
I now need help with a new problem....
I have my register/login in a dialog, How can I detect if a player has typed a wrong password. If a player types a wrong password 4 times, it kicks them. How can I do that?
pawn Код:
if(dialogid == REGDIAG) //Login
{
if(!response) return Kick(playerid);
{
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid, "You are already logged in");
if (!udb_Exists(PlayerName(playerid))) return ShowPlayerDialog(playerid, REGDIAG+1, DIALOG_STYLE_INPUT, "Account", "This name is not registered!\nPlease enter a password below", "Register", "Exit");
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "ERROR: You must enter your password!\n\nThis name is registered!\nPlease enter your password below!", "Login", "Exit");
if(udb_CheckLogin(PlayerName(playerid),inputtext))
{
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
robberrank[playerid] =dUserINT(PlayerName(playerid)).("robrank");
raperank[playerid] =dUserINT(PlayerName(playerid)).("raperank");
tazerank[playerid] =dUserINT(PlayerName(playerid)).("tazerank");
hitrank[playerid] =dUserINT(PlayerName(playerid)).("hitrank");
arrestrank[playerid] =dUserINT(PlayerName(playerid)).("arrestrank");
teamkiller[playerid] =dUserINT(PlayerName(playerid)).("teamkills");
innocentkiller[playerid] =dUserINT(PlayerName(playerid)).("innocentkills");
lowwantedkiller[playerid] =dUserINT(PlayerName(playerid)).("lowwantedkills");
BankRobInsurance[playerid] =dUserINT(PlayerName(playerid)).("cashinsured");
CanUseArmy[playerid] =dUserINT(PlayerName(playerid)).("canusearmy");
donator[playerid] =dUserINT(PlayerName(playerid)).("donator");
PlayerAdminLevel[playerid] =dUserINT(PlayerName(playerid)).("adminlevel");
RegularPlayer[playerid] =dUserINT(PlayerName(playerid)).("RegularPlayer");
JailTime[playerid] = dUserINT(PlayerName(playerid)).("jailtime");
PLAYERLIST_authed[playerid] = true;
return SystemMsg(playerid,"You are now logged in. Your stats will be auto-saved when you disconnect");
}
return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "ERROR: Invalid Password!\n\nPlease Try Again!\nEnter your password below!", "Login", "Exit");
}
}
else if(dialogid == REGDIAG+1) //Register
{
if(!response) return Kick(playerid);
{
new plrip[100];
GetPlayerIp(playerid,plrip,sizeof(plrip));
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged into your account");
if (udb_Exists(PlayerName(playerid))) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "This name is registered!\nPlease enter your password below!", "Login", "Exit");
if (RegisterLoginDisabled == 1337) return SystemMsg(playerid,"New Account Registrations are Disabled. This is due to maintenance");
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "ERROR: You must enter a password\n\nThis name is registered!\nPlease enter your password below!", "Login", "Exit");
if (udb_Create(PlayerName(playerid),inputtext))
{
dUserSetINT(PlayerName(playerid)).("money",7500);
dUserSetINT(PlayerName(playerid)).("bankcash",5000);
dUserSetINT(PlayerName(playerid)).("cashinsured",0);
dUserSetINT(PlayerName(playerid)).("regplayer",0);
dUserSetINT(PlayerName(playerid)).("score",0);
dUserSetINT(PlayerName(playerid)).("team",0);
dUserSetINT(PlayerName(playerid)).("skin",0);
dUserSetINT(PlayerName(playerid)).("Jailtime",0);
dUserSetINT(PlayerName(playerid)).("wallet",0);
dUserSetINT(PlayerName(playerid)).("cork",0);
dUserSetINT(PlayerName(playerid)).("drugs",0);
dUserSetINT(PlayerName(playerid)).("HasDrugBag",0);
dUserSetINT(PlayerName(playerid)).("adminlevel",0);
dUserSetINT(PlayerName(playerid)).("teamkills",0);
dUserSetINT(PlayerName(playerid)).("innocentkills",0);
dUserSetINT(PlayerName(playerid)).("lowwantedkills",0);
dUserSetINT(PlayerName(playerid)).("coprank",0);
dUserSetINT(PlayerName(playerid)).("robrank",0);
dUserSetINT(PlayerName(playerid)).("rpabusewar",0);
dUserSetINT(PlayerName(playerid)).("deaths",0);
dUserSetINT(PlayerName(playerid)).("finesissued",0);
dUserSetINT(PlayerName(playerid)).("finespaid",0);
dUserSetINT(PlayerName(playerid)).("nameban",0);
dUserSetINT(PlayerName(playerid)).("timesinfected",0);
dUserSetINT(PlayerName(playerid)).("timesraped",0);
dUserSetINT(PlayerName(playerid)).("timesrobbed",0);
dUserSetINT(PlayerName(playerid)).("timeshealed",0);
dUserSetINT(PlayerName(playerid)).("timescured",0);
dUserSetINT(PlayerName(playerid)).("canusearmy",0);
dUserSetINT(PlayerName(playerid)).("donator",0);
dUserSetINT(PlayerName(playerid)).("connectedminute",0);
dUserSetINT(PlayerName(playerid)).("connectedhour",0);
dUserSetINT(PlayerName(playerid)).("RegularPlayer",0);
dUserSet(PlayerName(playerid)).("ipaddress",plrip);
return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "Account Has Been Created!\nPlease enter your password below!", "Login", "Exit");
}
}
return true;
}
Re: Please help -
Carlton - 14.07.2010
https://sampforum.blast.hk/showthread.php?tid=118885
Re: Please help -
MWF2 - 14.07.2010
I'm not really asking for a new script or anything. I'm trying to fix mine, and make it work how it should. I tried many times, it's not working. can someone help me
Re: Please help -
MWF2 - 14.07.2010
I fixed my previous problems, Can someone help me with my new one. (Edited post)
Re: Please help -
ViruZZzZ_ChiLLL - 14.07.2010
Not sure, try this :
On top
pawn Код:
new attempts[MAX_PLAYERS];
The on the error part :
pawn Код:
if(attempts[playerid] == 4) return Kick(playerid);
attempts[playerid] ++;
Well, you get my point
Re: Please help -
MWF2 - 14.07.2010
This is what I did. It returns a warning though....
warning 225: unreachable code On line:
pawn Код:
if(loginchances[playerid] <= 3)
pawn Код:
if(dialogid == REGDIAG) //Login
{
if(!response) return Kick(playerid);
{
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid, "You are already logged in");
if (!udb_Exists(PlayerName(playerid))) return ShowPlayerDialog(playerid, REGDIAG+1, DIALOG_STYLE_INPUT, "ACCOUNT", "This name is not registered!\nPlease enter a password below", "Register", "Exit");
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "ACCOUNT", "ERROR: You must enter your password!\n\nThis name is registered!\nPlease enter your password below!", "Login", "Exit");
if(udb_CheckLogin(PlayerName(playerid),inputtext))
{
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
robberrank[playerid] =dUserINT(PlayerName(playerid)).("robrank");
raperank[playerid] =dUserINT(PlayerName(playerid)).("raperank");
tazerank[playerid] =dUserINT(PlayerName(playerid)).("tazerank");
hitrank[playerid] =dUserINT(PlayerName(playerid)).("hitrank");
arrestrank[playerid] =dUserINT(PlayerName(playerid)).("arrestrank");
teamkiller[playerid] =dUserINT(PlayerName(playerid)).("teamkills");
innocentkiller[playerid] =dUserINT(PlayerName(playerid)).("innocentkills");
lowwantedkiller[playerid] =dUserINT(PlayerName(playerid)).("lowwantedkills");
BankRobInsurance[playerid] =dUserINT(PlayerName(playerid)).("cashinsured");
CanUseArmy[playerid] =dUserINT(PlayerName(playerid)).("canusearmy");
donator[playerid] =dUserINT(PlayerName(playerid)).("donator");
PlayerAdminLevel[playerid] =dUserINT(PlayerName(playerid)).("adminlevel");
RegularPlayer[playerid] =dUserINT(PlayerName(playerid)).("RegularPlayer");
JailTime[playerid] = dUserINT(PlayerName(playerid)).("jailtime");
PLAYERLIST_authed[playerid] = true;
return SystemMsg(playerid,"You are now logged in. Your stats will be auto-saved when you disconnect");
}
return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "ACCOUNT", "ERROR: Invalid Password!\n\nPlease Try Again!\nEnter your password below!", "Login", "Exit");
if(loginchances[playerid] <= 3) {
loginchances[playerid] ++;
}
else
if(loginchances[playerid] >= 4) {
new str[100];
GetPlayerName(playerid, str, 24);
format(str, 100, "**(AUTO KICK)** %s(%d) Failed to login - Registered Playername", str,playerid);
SendClientMessageToAll(0xFF7F50AA, str);
printf("%s", str);
SetPlayerInterior(playerid,10);
SetPlayerPos(playerid,219.6257,111.2549,999.0156);
SetPlayerFacingAngle(playerid,2.2339);
SetCameraBehindPlayer(playerid);
ResetPlayerMoney(playerid);
ResetPlayerWeapons(playerid);
Kicking[playerid] =1;
SetTimer("KickPlayer",700,0);
}
}
}
Re: Please help -
MWF2 - 14.07.2010
Lol wow, Fixed.