Kick timer system?
#1

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.
Reply
#2

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;

Reply
#3

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;
}
Reply
#4

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?
Reply
#5

Excuse my ignorance
Reply
#6

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;
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)