login tries - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: login tries (
/showthread.php?tid=160894)
login tries -
Kar - 18.07.2010
hey how do i make it if login failed 3 times kick playerid
pawn Код:
if(dialogid == 1 || dialogid == 12347)
{
if(strlen(inputtext))
{
new ppw[20], str[128];
if(strlen(ppw) < 3) return SendMsg(playerid, RED, "*Error: Password Is Under The Limit Sorry");
if(strlen(ppw) > 20) return SendMsg(playerid, RED, "*Error: Password Is Over The Limit Sorry");
if(!dini_Exists(pfile)) return SendMsg(playerid, RED, "*Error: No account with that username is registered, please register");
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
if(strcmp(dini_Get(pfile, "Password"), ppw, true) == 1) return SendMsg(playerid, RED, "*Error: Wrong Password. Password Did Not Match With The One You Have Register With.");
format(str, sizeof(str), "*Success: You have Successfully Logged In %s", Playername(playerid), dini_Int(pfile, "AdminLevel"));
SendMsg(playerid, LIME, str);
LoadPlayer(playerid);
IsLogged[playerid] = 1;
SetTimerEx("TimePlayerLogged", 1000, true, "i", playerid);
}
else
{
new str[128];
format(str,sizeof(str),"Unsuccessfull: Wrong Password.");
SendMsg(playerid, RED, str);
IsLogged[playerid] = 0;
format(str,sizeof(str),"You Failed To Login Please Try Again\nPlease insert your password into the line below and click \"Login\" To Login. \n Click \"Cancel\" to cancel.",Playername(playerid));
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel");
}
}
Re: login tries -
cessil - 18.07.2010
pawn Код:
else
{
SetPVarInt(playerid,"passfails",GetPVarInt(playerid,"passfails")+1);
if(GetPVarInt(playerid,"passfails") == 3)
Re: login tries -
Kar - 18.07.2010
so
pawn Код:
if(dialogid == 1 || dialogid == 12347)
{
if(strlen(inputtext))
{
new ppw[20], str[128];
if(strlen(ppw) < 3) return SendMsg(playerid, RED, "*Error: Password Is Under The Limit Sorry");
if(strlen(ppw) > 20) return SendMsg(playerid, RED, "*Error: Password Is Over The Limit Sorry");
if(!dini_Exists(pfile)) return SendMsg(playerid, RED, "*Error: No account with that username is registered, please register");
format(pfile, sizeof(pfile), pfile_path, Playername(playerid));
if(strcmp(dini_Get(pfile, "Password"), ppw, true) == 1) return SendMsg(playerid, RED, "*Error: Wrong Password. Password Did Not Match With The One You Have Register With.");
format(str, sizeof(str), "*Success: You have Successfully Logged In %s", Playername(playerid), dini_Int(pfile, "AdminLevel"));
SendMsg(playerid, LIME, str);
LoadPlayer(playerid);
IsLogged[playerid] = 1;
SetTimerEx("TimePlayerLogged", 1000, true, "i", playerid);
}
else
{
new str[128];
format(str,sizeof(str),"Unsuccessfull: Wrong Password.");
SendMsg(playerid, RED, str);
IsLogged[playerid] = 0;
SetPVarInt(playerid,"passfails",GetPVarInt(playerid,"passfails")+1);
if(GetPVarInt(playerid,"passfails") == 3)
Kick(playerid);
format(str,sizeof(str),"You Failed To Login Please Try Again\nPlease insert your password into the line below and click \"Login\" To Login. \n Click \"Cancel\" to cancel.",Playername(playerid));
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel");
}
}
should work? sorry i've never used pvar;s
Re: login tries -
cessil - 18.07.2010
you're forgetting brackets but yes
Re: login tries -
Kar - 18.07.2010
this failed wtf.. 1. i can login with any pass 2.doesnt show back dialog>.<