diff options
Diffstat (limited to 'src/game/server/gamecontroller.cpp')
| -rw-r--r-- | src/game/server/gamecontroller.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index 854787d6..03372ad1 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -443,7 +443,9 @@ void IGameController::Tick() } // move the player to the other team + int Temp = pP->m_LastActionTick; pP->SetTeam(M^1); + pP->m_LastActionTick = Temp; pP->Respawn(); pP->m_ForceBalanced = true; @@ -453,6 +455,47 @@ void IGameController::Tick() } m_UnbalancedTick = -1; } + + // check for inactive players + if(g_Config.m_SvInactiveKickTime > 0) + { + for(int i = 0; i < MAX_CLIENTS; ++i) + { + if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != -1) + { + if(Server()->Tick() > GameServer()->m_apPlayers[i]->m_LastActionTick+g_Config.m_SvInactiveKickTime*Server()->TickSpeed()*60) + { + switch(g_Config.m_SvInactiveKick) + { + case 0: + { + // move player to spectator + GameServer()->m_apPlayers[i]->SetTeam(-1); + } + break; + case 1: + { + // move player to spectator if the reserved slots aren't filled yet, kick him otherwise + int Spectators = 0; + for(int j = 0; j < MAX_CLIENTS; ++j) + if(GameServer()->m_apPlayers[j] && GameServer()->m_apPlayers[j]->GetTeam() == -1) + ++Spectators; + if(Spectators >= g_Config.m_SvSpectatorSlots) + Server()->Kick(i, "kicked for inactivity"); + else + GameServer()->m_apPlayers[i]->SetTeam(-1); + } + break; + case 2: + { + // kick the player + Server()->Kick(i, "Kicked for inactivity"); + } + } + } + } + } + } // update browse info int Prog = -1; |