From 1bd2c55ce4a8cf2025bfe198d74b56dc1461bd79 Mon Sep 17 00:00:00 2001 From: Eason <62255465+jonathan-up@users.noreply.github.com> Date: Sun, 4 Aug 2024 16:44:21 +0800 Subject: [PATCH] Cvar sv_allchat 2 to set spectator text message visible dead only (#17) --- README.md | 2 +- dist/game.cfg | 1 + regamedll/dlls/client.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ad6361ae..6f600bf54 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_team_flash | 1 | -1 | 1 | Sets the behaviour for Flashbangs on teammates.
`-1` Don't affect teammates neither flash owner
`0` Don't affect teammates
`1` Affects teammates | | mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.
`0` No fade.
`1` Fade to black and won't be able to watch anybody.
`2` fade to black only on kill moment. | | mp_falldamage | 1 | 0 | 1 | Damage from falling.
`0` disabled
`1` enabled | -| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply
`0` disabled
`1` enabled | +| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply
`0` disabled
`1` enabled
`2` enabled, but only dead player can see spectator's message | | sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.
`0` disabled
`1` enabled | | sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.
`0` disabled
`1` enabled | | mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.
`0` disabled
`1` enabled | diff --git a/dist/game.cfg b/dist/game.cfg index 96e313aa4..2541ac75c 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -485,6 +485,7 @@ mp_team_flash "1" // Players can receive all other players text chat, team restrictions apply. // 0 - disabled (default behaviour) // 1 - enabled +// 2 - enabled, but only dead player can see spectator'smessage // // Default value: "0" sv_allchat "0" diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 7d3fb659e..961175644 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -1010,6 +1010,17 @@ void Host_Say(edict_t *pEntity, BOOL teamonly) continue; } + // when allchat is 2,only dead player can see spectator's message + if ( +#ifdef REGAMEDLL_ADD + allchat.value == 2.0f && +#endif + (pPlayer->m_iTeam == UNASSIGNED || pPlayer->m_iTeam == SPECTATOR) + ) { + if (pReceiver->pev->deadflag == DEAD_NO) + continue; + } + if ((pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_ENEMY && pReceiver->m_iTeam == pPlayer->m_iTeam) || pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_NONE) {