diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index f7f8b2d9c..71e17c5a6 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -702,7 +702,8 @@ int CServer::DistinctClientCount() const int ClientCount = 0; for(int i = 0; i < MAX_CLIENTS; i++) { - if(m_aClients[i].m_State != CClient::STATE_EMPTY) + // connecting clients with spoofed ips can clog slots without being ingame + if(ClientIngame(i)) { ClientCount++; for(int j = 0; j < i; j++) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 100569b98..0bcc60f75 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -930,7 +930,7 @@ void CGameContext::OnTick() continue; // connecting clients with spoofed ips can clog slots without being ingame - if(((CServer *)Server())->m_aClients[i].m_State != CServer::CClient::STATE_INGAME) + if(!Server()->ClientIngame(i)) continue; // don't count votes by blacklisted clients @@ -1507,7 +1507,8 @@ void CGameContext::OnClientConnected(int ClientID, void *pData) bool Empty = true; for(auto &pPlayer : m_apPlayers) { - if(pPlayer) + // connecting clients with spoofed ips can clog slots without being ingame + if(pPlayer && Server()->ClientIngame(pPlayer->GetCID())) { Empty = false; break;