else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5)))
{
int minplayers = max(0, floor(autocvar_minplayers));
+ if (teamplay)
+ minplayers = max(0, floor(autocvar_minplayers_per_team) * AvailableTeams());
int minbots = max(0, floor(autocvar_bot_number));
// add bots to reach minplayers if needed
// cap bots to the max players allowed by the server
int player_limit = GetPlayerLimit();
if(player_limit)
- bots = min(bots, player_limit - activerealplayers);
+ bots = min(bots, max(player_limit - activerealplayers, 0));
bots = min(bots, maxclients - realplayers);
if(bots > minbots)
return false;
}
}
- while (currentbots > bots)
+ while (currentbots > bots && bots >= 0)
bot_removenewest();
}