3 Login Attempts
#1

Hello, how to make that you have 3 login attemps and if that fail you will be kicked?
Reply
#2

Create some variable like LoginAttempt[MAX_PLAYERS] and each time when the player enters an incorrect password, add 1 to the variable. When the variable reaches number of 3, just kick the player.
Reply
#3

edit: dominik523 was faster and explain it better then me
Reply
#4

pawn Код:
#define MAX_TRY_TO_LOGIN 3
pawn Код:
TryedLogin[playerid]++;// On login
                if(TryedLogin[playerid] >= MAX_TRY_TO_LOGIN)
                {
                    Kick(playerid);
                }
Reply
#5

Quote:
Originally Posted by dominik523
Посмотреть сообщение
Create some variable like LoginAttempt[MAX_PLAYERS] and each time when the player enters an incorrect password, add 1 to the variable. When the variable reaches number of 3, just kick the player.
Can you give me a example please?
Reply
#6

pawn Код:
new LoginAttempt[MAX_PLAYERS];//global variable.
//on your login system , when the player input wrong password
LoginAttempt[playerid] ++;
if(LoginAttempt[playerid] == 3) Kick(playerid);
Reply
#7

pawn Код:
// global:
new
    Player_LoginAttempts[MAX_PLAYERS];

// OnPlayerConnect:
Player_LoginAttempts[playerid] = 0;

// When a player is trying to login:
if (++Player_LoginAttempts[playerid] >= 3)
{
    // kick player for 3 or more wrong login attempts..
}
else
{
    // inform the player that the password is wrong and let them try again..
}
Reply
#8

done thanks.
Reply
#9

But you'll need to increase the variable +1 first , to check if his loginattemp equal too 1,2,3 ...
pawn Код:
//however your codes is , when the player enter the wrong password
LoginAttemp[playerid] ++;
Reply
#10

~~~~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)