| 44 | IGameController::~IGameController() = default; |
| 45 | |
| 46 | void IGameController::DoActivityCheck() |
| 47 | { |
| 48 | if(g_Config.m_SvInactiveKickTime == 0) |
| 49 | return; |
| 50 | |
| 51 | for(int i = 0; i < MAX_CLIENTS; ++i) |
| 52 | { |
| 53 | if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS && !Server()->IsRconAuthed(i)) |
| 54 | { |
| 55 | if(Server()->Tick() > GameServer()->m_apPlayers[i]->m_LastActionTick + g_Config.m_SvInactiveKickTime * Server()->TickSpeed() * 60) |
| 56 | { |
| 57 | switch(g_Config.m_SvInactiveKick) |
| 58 | { |
| 59 | case 0: |
| 60 | { |
| 61 | // move player to spectator |
| 62 | DoTeamChange(GameServer()->m_apPlayers[i], TEAM_SPECTATORS); |
| 63 | } |
| 64 | break; |
| 65 | case 1: |
| 66 | { |
| 67 | // move player to spectator if the reserved slots aren't filled yet, kick them otherwise |
| 68 | int Spectators = 0; |
| 69 | for(auto &pPlayer : GameServer()->m_apPlayers) |
| 70 | if(pPlayer && pPlayer->GetTeam() == TEAM_SPECTATORS) |
| 71 | ++Spectators; |
| 72 | if(Spectators >= g_Config.m_SvSpectatorSlots) |
| 73 | Server()->Kick(i, "Kicked for inactivity"); |
| 74 | else |
| 75 | DoTeamChange(GameServer()->m_apPlayers[i], TEAM_SPECTATORS); |
| 76 | } |
| 77 | break; |
| 78 | case 2: |
| 79 | { |
| 80 | // kick the player |
| 81 | Server()->Kick(i, "Kicked for inactivity"); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | float IGameController::EvaluateSpawnPos(CSpawnEval *pEval, vec2 Pos, int ClientId) |
| 90 | { |