From 5aad7fb6cd91e7da6bc6479322f69991b8fe8db1 Mon Sep 17 00:00:00 2001
From: terencehill <piuntn@gmail.com>
Date: Fri, 12 Jun 2015 00:57:24 +0200
Subject: [PATCH] shuffleteams: properly detect ca players. It fixes #1471
 "Shuffleteams results in uneven teams (CA)"

---
 qcsrc/server/command/sv_cmd.qc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc
index 43c53792e..0bf2df320 100644
--- a/qcsrc/server/command/sv_cmd.qc
+++ b/qcsrc/server/command/sv_cmd.qc
@@ -1399,7 +1399,8 @@ void GameCommand_shuffleteams(float request)
 				// count the total amount of players and total amount of teams
 				t_players = 0;
 				t_teams = 0;
-				FOR_EACH_PLAYER(tmp_player)
+				FOR_EACH_CLIENT(tmp_player)
+				if(IS_PLAYER(tmp_player) || tmp_player.caplayer)
 				{
 					CheckAllowedTeams(tmp_player);
 
@@ -1412,7 +1413,8 @@ void GameCommand_shuffleteams(float request)
 				}
 
 				// build a list of the players in a random order
-				FOR_EACH_PLAYER(tmp_player)
+				FOR_EACH_CLIENT(tmp_player)
+				if(IS_PLAYER(tmp_player) || tmp_player.caplayer)
 				{
 					for (;;)
 					{
-- 
2.39.5