From b612c917309718c140085875597ef27f66785042 Mon Sep 17 00:00:00 2001
From: Mario <mario@smbclan.net>
Date: Thu, 27 Sep 2018 12:06:03 +1000
Subject: [PATCH] Make bots obey g_maxplayers

---
 qcsrc/server/bot/default/bot.qc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc
index 2a6164a28..12e93821f 100644
--- a/qcsrc/server/bot/default/bot.qc
+++ b/qcsrc/server/bot/default/bot.qc
@@ -607,6 +607,8 @@ float bot_fixcount()
 		// add bots to reach minplayers if needed
 		bots = max(minbots, minplayers - activerealplayers);
 		// cap bots to the max players allowed by the server
+		if(autocvar_g_maxplayers)
+			bots = min(bots, autocvar_g_maxplayers - activerealplayers);
 		bots = min(bots, maxclients - realplayers);
 
 		if(bots > minbots)
-- 
2.39.5