[Solved]Idle spectator auto-kick
Hello,
I have really silly question but I just could not find the answer anywhere..
I'm working on the system that will kick non-active players if more than 12 people are connected. I'm currently at this stage:

CatchEvent OnIdle1( $userName ) # Player CatchEvent
$OnIdleTimeout1 = 10; # Idle timeout for OnIdleAction1 in seconds
$numConns = GetLapperVar("numconns");
IF ( $numConns > 12 )
THEN
privMsg("You are idle and will be kicked soon!");
ENDIF

EndCatchEvent


CatchEvent OnIdle2( $userName ) # Player CatchEvent
$OnIdleTimeout2 = 20; # Idle timeout for OnIdleAction2 in seconds
$numConns = GetLapperVar("numconns");
IF ( $numConns > 12 )
THEN
GlobalMsg( GetCurrentPlayerVar("UserName") . " ^1WAS KICKED FOR NON-ACTIVITY!");
cmdLFS("/kick " . GetCurrentPlayerVar("UserName") );
ENDIF
EndCatchEvent

This works but it does not work for spectators, only for players on track.
I even tried to use
IF(GetCurrentPlayerVar( "OnTrack" ) == 0)

but this does not seem to work.
Is it even possible with Lapper?

Thanks, Lakyn
OnIdle is specifically for cars on track.

You could maybe try the OnLeaveRace event.
Quote from sinanju :OnIdle is specifically for cars on track.

You could maybe try the OnLeaveRace event.

Thank you sinanju!

I made this:

CatchEvent OnLeaveRace( $userName ) # Player CatchEvent
$numConns = GetLapperVar("numconns");
IF ( $numConns > 12 )
THEN
privDelayedCommand( 5, testing1 );
ENDIF
EndCatchEvent

Sub testing1( $userName )
privMsg( "Test" );
EndSub

and it's working as it should.. I'll try to finish it tomorrow and will edit this post if any problem appears. But for now - problem solvedThumbs up
This thread is closed

FGED GREDG RDFGDR GSFDG