Posts: 11
Threads: 4
Joined: Jul 2015
Reputation:
0
Hi everybody
I want to make a connection system I already do but I would like that when the player puts his password after 3 attempts ehouй his kick but I can not get you help me please
Posts: 455
Threads: 29
Joined: Apr 2014
PHP код:
//new variable
new Attempts[MAX_PLAYERS];
//OnPlayerConnect
Attempts[playerid] = 0;
//Enters password wrong
Attempts[playerid]++;
if(Attempts[playerid] == 3) return Kick(playerid);
Posts: 455
Threads: 29
Joined: Apr 2014
Quote:
Originally Posted by Michael B
This should work:
PHP код:
#define COLOR_RED 0xAA3333AA // At the top of your gamemode.
new PassAttempt[MAX_PLAYERS];
Pass Attempt[playerid] ++;
if(PassAttempt[playerid] == 3)
{
SendClientMessage(playerid, COLOR_RED,"Warning: You were kicked from the server due to multiple password input failure.");
Kick(playerid);
return 1;
}
|
No it doesnt work, because you dont reset variable, after someone has tried to enter password and failed and disconnects.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
This is one of those rare occasions that you might actually want to use PVars, if we assume that most players will put their password correctly the first time around.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Because you don't want to create a MAX_PLAYER array if 99% of it is just going to be 0 all the time.