diff --git a/main/server.cfg b/main/server.cfg index d9a4768..6538d29 100644 --- a/main/server.cfg +++ b/main/server.cfg @@ -49,8 +49,8 @@ set rcon_password "qazqaz" // Access to your server to change stuff remot set sv_securityLevel "23" // Configures the servers security level. set sv_customTextColor "" // custom color for ^; set g_password "" // Password Protected Server. Leave blank if you want players to join -set g_inactivity "380" // Enable auto kick feature for idle/AFK players -set g_inactivitySpectator "380" // Time in seconds before a spectator gets kicked +set g_inactivity "180" // Enable auto kick feature for idle/AFK players +set g_inactivitySpectator "180" // Time in seconds before a spectator gets kicked set g_logSync "1" // 1 always flush games_mp.log, 0 only flush on game end set g_log "logs/games_mp.log" // Gamelog filename. If you edit this..make sure you change B3.xml if you have bigbrotherbot. set sv_allowClientConsole "1" // Enable or Disable players ability to access server commands diff --git a/userraw/scripts/spectatorKick.gsc b/userraw/scripts/spectatorKick.gsc new file mode 100644 index 0000000..bb24a69 --- /dev/null +++ b/userraw/scripts/spectatorKick.gsc @@ -0,0 +1,43 @@ +#include common_scripts\utility; +#include maps\mp\_utility; +#include maps\mp\gametypes\_hud_util; + +init() +{ + setDvarIfUninitialized( "g_inactivitySpectator", 0.0 ); + level.inactivitySpectator = getDvarFloat("g_inactivitySpectator") * 1000; + + if (level.inactivitySpectator <= 0) + return; + + thread watchPlayers(); +} + +watchPlayers() +{ + for(;;) + { + wait 1.5; + + theTime = getTime(); + + for (i = 0; i < level.players.size; i++) + { + player = level.players[i]; + + if (player.hasSpawned) + continue; + + if (!isDefined(player.specTime)) + { + player.specTime = theTime; + continue; + } + + if ((theTime - player.specTime) < level.inactivitySpectator) + continue; + + kick( player getEntityNumber(), "EXE_PLAYERKICKED_INACTIVE" ); + } + } +}