3 Login Attempts - 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)
+--- Thread: 3 Login Attempts (
/showthread.php?tid=484581)
3 Login Attempts -
Blackazur - 31.12.2013
Hello, how to make that you have 3 login attemps and if that fail you will be kicked?
Re: 3 Login Attempts -
dominik523 - 31.12.2013
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.
Re: 3 Login Attempts -
doreto - 31.12.2013
edit: dominik523 was faster and explain it better then me
Re: 3 Login Attempts -
Stereotype - 31.12.2013
pawn Код:
#define MAX_TRY_TO_LOGIN 3
pawn Код:
TryedLogin[playerid]++;// On login
if(TryedLogin[playerid] >= MAX_TRY_TO_LOGIN)
{
Kick(playerid);
}
AW: Re: 3 Login Attempts -
Blackazur - 31.12.2013
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?
Re: 3 Login Attempts -
SilentSoul - 31.12.2013
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);
Re: 3 Login Attempts -
Konstantinos - 31.12.2013
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..
}
AW: 3 Login Attempts -
Blackazur - 31.12.2013
done thanks.
Re: 3 Login Attempts -
SilentSoul - 31.12.2013
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] ++;
AW: 3 Login Attempts -
Blackazur - 31.12.2013
~~~~