From 93bf7cbc59d42350e14e82127f3aab6ba0d1f7f4 Mon Sep 17 00:00:00 2001 From: furo Date: Mon, 24 Jun 2024 18:21:42 +0200 Subject: [PATCH] Don't check `sv_max_team_size` for teams in practice --- src/game/server/ddracechat.cpp | 2 +- src/game/server/teams.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 6941eb35f..96f11984f 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -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); diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp index 75a8e4d30..daeeb7c54 100644 --- a/src/game/server/teams.cpp +++ b/src/game/server/teams.cpp @@ -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];