From e80a76687051a5012c95467491110b20eb15f203 Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Wed, 9 Oct 2019 15:09:23 +0500 Subject: [PATCH] StatusText: Don't show hp on ffa mode (#431) * StatusText: Don't show hp on ffa mode * same fixes for new features (scoreboard show money/health) --- regamedll/dlls/player.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 5218b53b..5c64245a 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -7237,13 +7237,13 @@ bool CBasePlayer::ShouldToShowAccount(CBasePlayer *pReceiver) const switch (iShowAccount) { // show field to teammates - case 3: return pReceiver->m_iTeam == m_iTeam; + case 3: return !CSGameRules()->IsFreeForAll() && pReceiver->m_iTeam == m_iTeam; // show field to all clients case 4: return true; // show field to teammates and spectators - case 5: return (pReceiver->m_iTeam == m_iTeam || pReceiver->m_iTeam == SPECTATOR); + case 5: return ((!CSGameRules()->IsFreeForAll() && pReceiver->m_iTeam == m_iTeam) || pReceiver->m_iTeam == SPECTATOR); default: break; } @@ -7269,13 +7269,13 @@ bool CBasePlayer::ShouldToShowHealthInfo(CBasePlayer *pReceiver) const switch (iShowHealth) { // show field to teammates - case 3: return pReceiver->m_iTeam == m_iTeam; + case 3: return !CSGameRules()->IsFreeForAll() && pReceiver->m_iTeam == m_iTeam; // show field to all clients case 4: return true; // show field to teammates and spectators - case 5: return (pReceiver->m_iTeam == m_iTeam || pReceiver->m_iTeam == SPECTATOR); + case 5: return ((!CSGameRules()->IsFreeForAll() && pReceiver->m_iTeam == m_iTeam) || pReceiver->m_iTeam == SPECTATOR); default: break; } @@ -7517,10 +7517,12 @@ void CBasePlayer::UpdateStatusBar() { CBasePlayer *pTarget = (CBasePlayer *)pEntity; - newSBarState[SBAR_ID_TARGETNAME] = ENTINDEX(pTarget->edict()); - newSBarState[SBAR_ID_TARGETTYPE] = (pTarget->m_iTeam == m_iTeam) ? SBAR_TARGETTYPE_TEAMMATE : SBAR_TARGETTYPE_ENEMY; + bool sameTeam = !CSGameRules()->IsFreeForAll() && pTarget->m_iTeam == m_iTeam; - if (pTarget->m_iTeam == m_iTeam || GetObserverMode() != OBS_NONE) + newSBarState[SBAR_ID_TARGETNAME] = ENTINDEX(pTarget->edict()); + newSBarState[SBAR_ID_TARGETTYPE] = sameTeam ? SBAR_TARGETTYPE_TEAMMATE : SBAR_TARGETTYPE_ENEMY; + + if (sameTeam || GetObserverMode() != OBS_NONE) { if (playerid.value != PLAYERID_MODE_OFF || GetObserverMode() != OBS_NONE) Q_strcpy(sbuf0, "1 %c1: %p2\n2 %h: %i3%%");