about summary refs log tree commit diff
path: root/src/game/server
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-03-04 17:35:50 +0100
committeroy <Tom_Adams@web.de>2011-03-04 17:35:50 +0100
commit0640acb27e9ffb756439aec07b6b07c8ec314c01 (patch)
tree32e9e3f65980401f9f3230550ecd1b28049d1621 /src/game/server
parent9811c2396baa86e3401caef295649eaf3e12a4a5 (diff)
downloadzcatch-0640acb27e9ffb756439aec07b6b07c8ec314c01.tar.gz
zcatch-0640acb27e9ffb756439aec07b6b07c8ec314c01.zip
added a command to set a minimum player limit that is needed to start a kick vote
Diffstat (limited to 'src/game/server')
-rw-r--r--src/game/server/gamecontext.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp
index 8ef7de88..44d9b6fc 100644
--- a/src/game/server/gamecontext.cpp
+++ b/src/game/server/gamecontext.cpp
@@ -650,6 +650,21 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
 				SendChatTarget(ClientID, "Server does not allow voting to kick players");
 				return;
 			}
+
+			if(g_Config.m_SvVoteKickMin)
+			{
+				int PlayerNum = 0;
+				for(int i = 0; i < MAX_CLIENTS; ++i)
+					if(m_apPlayers[i] && m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS)
+						++PlayerNum;
+
+				if(PlayerNum < g_Config.m_SvVoteKickMin)
+				{
+					str_format(aChatmsg, sizeof(aChatmsg), "Kick voting requires %d players on the server", g_Config.m_SvVoteKickMin);
+					SendChatTarget(ClientID, aChatmsg);
+					return;
+				}
+			}
 			
 			int KickID = str_toint(pMsg->m_Value);
 			if(KickID < 0 || KickID >= MAX_CLIENTS || !m_apPlayers[KickID])