SA-MP Forums Archive
kick after 3 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: kick after 3 attempts (/showthread.php?tid=581062)



kick after 3 attempts - 59GVR6 - 10.07.2015

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


Re: kick after 3 attempts - CodeStyle175 - 10.07.2015

PHP код:
//new variable
new Attempts[MAX_PLAYERS];
//OnPlayerConnect
Attempts[playerid] = 0;
//Enters password wrong
Attempts[playerid]++;
if(
Attempts[playerid] == 3) return Kick(playerid); 



Re: kick after 3 attempts - Michael B - 10.07.2015

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(playeridCOLOR_RED,"Warning: You were kicked from the server due to multiple password input failure.");
Kick(playerid);
return 
1;




Re: kick after 3 attempts - CodeStyle175 - 10.07.2015

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(playeridCOLOR_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.


Re : kick after 3 attempts - 59GVR6 - 10.07.2015

It does not work


Re: kick after 3 attempts - Vince - 10.07.2015

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.


Re : kick after 3 attempts - 59GVR6 - 10.07.2015

Please to avoid abuses


Re: kick after 3 attempts - $$inSane - 10.07.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
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.
Why would you use PVars if the dialogs are to be handled in one individual script.


Re: kick after 3 attempts - Vince - 10.07.2015

Because you don't want to create a MAX_PLAYER array if 99% of it is just going to be 0 all the time.


Re : kick after 3 attempts - 59GVR6 - 10.07.2015

How the code please ?