prevent that you can switch to spectators when teams are locked. #1948

This commit is contained in:
oy 2019-01-05 14:50:34 +01:00
parent 5a627cc215
commit 6cc85bdcc0

View file

@ -30,15 +30,15 @@ void CMenus::GetSwitchTeamInfo(CSwitchTeamInfo *pInfo)
pInfo->m_AllowSpec = true; pInfo->m_AllowSpec = true;
pInfo->m_TimeLeft = 0; pInfo->m_TimeLeft = 0;
if(TeamMod + m_pClient->m_GameInfo.m_aTeamSize[TEAM_RED] + m_pClient->m_GameInfo.m_aTeamSize[TEAM_BLUE] >= m_pClient->m_ServerSettings.m_PlayerSlots) if(m_pClient->m_ServerSettings.m_TeamLock)
{
str_format(pInfo->m_aNotification, sizeof(pInfo->m_aNotification), Localize("Only %d active players are allowed"), m_pClient->m_ServerSettings.m_PlayerSlots);
}
else if(m_pClient->m_ServerSettings.m_TeamLock)
{ {
str_copy(pInfo->m_aNotification, Localize("Teams are locked"), sizeof(pInfo->m_aNotification)); str_copy(pInfo->m_aNotification, Localize("Teams are locked"), sizeof(pInfo->m_aNotification));
pInfo->m_AllowSpec = false; pInfo->m_AllowSpec = false;
} }
else if(TeamMod + m_pClient->m_GameInfo.m_aTeamSize[TEAM_RED] + m_pClient->m_GameInfo.m_aTeamSize[TEAM_BLUE] >= m_pClient->m_ServerSettings.m_PlayerSlots)
{
str_format(pInfo->m_aNotification, sizeof(pInfo->m_aNotification), Localize("Only %d active players are allowed"), m_pClient->m_ServerSettings.m_PlayerSlots);
}
else if(m_pClient->m_TeamCooldownTick + 1 >= Client()->GameTick()) else if(m_pClient->m_TeamCooldownTick + 1 >= Client()->GameTick())
{ {
pInfo->m_TimeLeft = (m_pClient->m_TeamCooldownTick - Client()->GameTick()) / Client()->GameTickSpeed() + 1; pInfo->m_TimeLeft = (m_pClient->m_TeamCooldownTick - Client()->GameTick()) / Client()->GameTickSpeed() + 1;