login tries
#1

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");
            }
        }
Reply
#2

pawn Код:
else
            {
                  SetPVarInt(playerid,"passfails",GetPVarInt(playerid,"passfails")+1);
                  if(GetPVarInt(playerid,"passfails") == 3)
Reply
#3

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
Reply
#4

you're forgetting brackets but yes
Reply
#5

this failed wtf.. 1. i can login with any pass 2.doesnt show back dialog>.<
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)