- float realminbots, minbots;
- realminbots = autocvar_bot_number;
- minbots = max(0, floor(realminbots));
+ // add bots to reach minplayers if needed
+ bots = max(minbots, minplayers - activerealplayers);
+ // cap bots to the max players allowed by the server
+ int player_limit = GetPlayerLimit();
+ if(player_limit)
+ bots = min(bots, max(player_limit - activerealplayers, 0));
+ bots = min(bots, maxclients - realplayers);