Don't check sv_max_team_size for teams in practice

This commit is contained in:
furo 2024-06-24 18:21:42 +02:00
parent 003a58cdc7
commit 93bf7cbc59
2 changed files with 10 additions and 1 deletions

View file

@ -1050,7 +1050,7 @@ void CGameContext::AttemptJoinTeam(int ClientId, int Team)
"This team is locked using /lock. Only members of the team can unlock it using /lock." :
"This team is locked using /lock. Only members of the team can invite you or unlock it using /lock.");
}
else if(Team > 0 && Team < MAX_CLIENTS && m_pController->Teams().Count(Team) >= g_Config.m_SvMaxTeamSize && !m_pController->Teams().TeamFlock(Team))
else if(Team > 0 && Team < MAX_CLIENTS && m_pController->Teams().Count(Team) >= g_Config.m_SvMaxTeamSize && !m_pController->Teams().TeamFlock(Team) && !m_pController->Teams().IsPractice(Team))
{
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "This team already has the maximum allowed size of %d players", g_Config.m_SvMaxTeamSize);

View file

@ -1106,6 +1106,15 @@ void CGameTeams::OnCharacterDeath(int ClientId, int Weapon)
if(Count(Team) > 1)
{
// Disband team if the team has more players than allowed.
if(Count(Team) > g_Config.m_SvMaxTeamSize)
{
GameServer()->SendChatTeam(Team, "This team was disbanded because there are more players than allowed in the team.");
SetTeamLock(Team, false);
KillTeam(Team, Weapon == WEAPON_SELF ? ClientId : -1, ClientId);
return;
}
KillTeam(Team, Weapon == WEAPON_SELF ? ClientId : -1, ClientId);
char aBuf[512];