Add error message when trying to /swap on forced solo server

Previously, swapping on forced solo servers was already impossible, as this would require two players to join the same team, so it would always fail with the error `Player is on a different team` (or earlier). The check `g_Config.m_SvTeam != 3` was never reached. Also, this check was not using the constant `SV_TEAM_FORCED_SOLO`. Now, an earlier check is added to show a more specific error message when trying to use `/swap` on a forced solo server.
This commit is contained in:
Robert Müller 2024-08-01 21:33:48 +02:00
parent 44ff68a22e
commit f676a8b9ad

View file

@ -744,6 +744,15 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
return;
}
if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO)
{
pSelf->Console()->Print(
IConsole::OUTPUT_LEVEL_STANDARD,
"chatresp",
"Swap is not available on forced solo servers.");
return;
}
CGameTeams &Teams = pSelf->m_pController->Teams();
int Team = Teams.m_Core.Team(pResult->m_ClientId);
@ -804,7 +813,7 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
}
CPlayer *pSwapPlayer = pSelf->m_apPlayers[TargetClientId];
if((Team == TEAM_FLOCK || Teams.TeamFlock(Team)) && g_Config.m_SvTeam != 3)
if(Team == TEAM_FLOCK || Teams.TeamFlock(Team))
{
CCharacter *pChr = pPlayer->GetCharacter();
CCharacter *pSwapChr = pSwapPlayer->GetCharacter();