Skip to content

Commit

Permalink
Sv allchat 2 (#9)
Browse files Browse the repository at this point in the history
* cvar sv_allchat 2 to set spectator text message visible dead only

* Update game.cfg
  • Loading branch information
jonathan-up authored Jul 28, 2024
1 parent 03c57a1 commit f8242f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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
3 changes: 2 additions & 1 deletion 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's message
//
// Default value: "0"
sv_allchat "0"
Expand Down Expand Up @@ -521,7 +522,7 @@ mp_give_c4_frags "3"
// Default value: "1.0"
mp_hostages_rescued_ratio "1.0"

// Legacy func_vehicle behavior when blocked by another entity.
// Legacy func_vehicle behavior when blocked by another entity.
// New one is more useful for playing multiplayer.
//
// 0 - New behavior
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 f8242f3

Please sign in to comment.