Kick timer system? - 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 timer system? (
/showthread.php?tid=647277)
Kick timer system? -
spyro9696 - 02.01.2018
Hello, is there a good kick timer system?
In order to when a player join in a server, he is kicked after 10 seconds if he does not log in in time.
Re: Kick timer system? -
RogueDrifter - 02.01.2018
there's nothing such as a kick timer system lol simply use
SetTimerEx here's an example of what you want, recall that i said
EXAMPLE so don't just copy paste this in your script:
PHP код:
#define CHECK_TIME_IN_SECONDS 50 //time in seconds to check after player connects (50 here)
public OnPlayerConnect(playerid)
{
SetTimerEx("KickLogCheck",CHECK_TIME_IN_SECONDS*1000,false,"d",playerid);//the timer
return 1;
}
forward KickLogCheck(playerid);
public KickLogCheck(playerid)//the function called by the timer after the time
{
if(!IsPlayerLoggedIn[playerid])//if the player didnt login after the time passed
{
Kick(playerid);//kick him
}
return 1;
}
Re: Kick timer system? -
Romz - 02.01.2018
Add to Variables:
Код:
new LoginTimer[MAX_PLAYERS];
Start login:
Код:
LoginTimer[playerid] = SetTimerEx("KickPlayer", 10000, false, "i", playerid);
Good login:
Код:
KillTimer(LoginTimer[playerid]);
LoginTimer[playerid] = 0;
At the very bottom of your mode:
Код:
forward KickPlayer(playerid);
public KickPlayer(playerid) {
Kick(playerid);
LoginTimer[playerid] = 0;
return 1;
}
Re: Kick timer system? -
spyro9696 - 02.01.2018
Quote:
Start login:
Code:
LoginTimer[playerid] = SetTimerEx("KickPlayer", 10000, false, "i", playerid);
|
Quote:
Good login:
Code:
KillTimer(LoginTimer[playerid]);
LoginTimer[playerid] = 0;
|
Where should I put these two things?
Re: Kick timer system? -
spyro9696 - 02.01.2018
Excuse my ignorance
Re: Kick timer system? -
jasperschellekens - 02.01.2018
Quote:
Originally Posted by spyro9696
Where should I put these two things?
|
put it under OnPlayerRequestClass
Код:
LoginTimer[playerid] = SetTimerEx("KickPlayer", 10000, false, "i", playerid);
And put this if the player has succefully loggedin.
Код:
KillTimer(LoginTimer[playerid]);
LoginTimer[playerid] = 0;
Re: Kick timer system? -
Beckett - 04.01.2018
Try to understand what you're doing before compiling it otherwise there's no way you're going to learn. It's simple, set a timer when someone connects to the server of ten seconds -- if the player logs on, then kill the said timer. If the player doesn't log in then the ten seconds will pass therefore they will be kicked.