mirror of
https://github.com/ineedbots/iw5_bot_warfare.git
synced 2025-04-25 23:29:12 +00:00
added spectatorkick script
This commit is contained in:
parent
c5ca6a23dd
commit
601a4fe457
43
raw/scripts/spectatorKick.gsc
Normal file
43
raw/scripts/spectatorKick.gsc
Normal file
@ -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" );
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user