From 311e89c79db9f45bf01a3c8ae940f454677d661d Mon Sep 17 00:00:00 2001 From: def Date: Thu, 16 Aug 2018 21:42:10 +0200 Subject: [PATCH] Fix votes --- src/game/server/gamecontext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 51abc12f2..647ae88b5 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -734,7 +735,7 @@ void CGameContext::OnTick() aVoteChecked[i]) // don't count in votes by spectators if the admin doesn't want it continue; - if((m_VoteKick || m_VoteSpec) && ((!m_apPlayers[i] || m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS) || + if((m_VoteKick || m_VoteSpec) && (m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS || (GetPlayerChar(m_VoteCreator) && GetPlayerChar(i) && GetPlayerChar(m_VoteCreator)->Team() != GetPlayerChar(i)->Team()))) continue; @@ -742,6 +743,10 @@ void CGameContext::OnTick() if(m_apPlayers[i]->m_Afk && i != m_VoteCreator) continue; + // connecting clients with spoofed ips can clog slots without being ingame + if(((CServer*)Server())->m_aClients[i].m_State != CServer::CClient::STATE_INGAME) + continue; + // don't count votes by blacklisted clients if(g_Config.m_SvDnsblVote && !m_pServer->DnsblWhite(i)) continue;