Skip to content

Commit

Permalink
Cvar sv_allchat 2 to set spectator text message visible dead only (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-up authored Aug 4, 2024
1 parent 9d9c2de commit 1bd2c55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>`-1` Don't affect teammates neither flash owner <br/>`0` Don't affect teammates <br/>`1` Affects teammates |
| mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.<br/> `0` No fade.<br/>`1` Fade to black and won't be able to watch anybody.<br/>`2` fade to black only on kill moment. |
| mp_falldamage | 1 | 0 | 1 | Damage from falling.<br/>`0` disabled <br/>`1` enabled |
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled |
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled <br/> `2` enabled, but only dead player can see spectator's message |
| sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.<br/>`0` disabled <br/>`1` enabled |
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.<br/>`0` disabled <br/>`1` enabled |
| mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.<br/>`0` disabled <br/>`1` enabled |
Expand Down
1 change: 1 addition & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 11 additions & 0 deletions regamedll/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1bd2c55

Please sign in to comment.