From fbbd6bd0838749753e10499a77477bf2fb2324b1 Mon Sep 17 00:00:00 2001 From: Sergey Shorokhov Date: Sat, 28 Aug 2021 13:41:49 +0300 Subject: [PATCH] Add new CVar sv_allchat (#665) --- README.md | 1 + dist/game.cfg | 7 +++++++ regamedll/dlls/client.cpp | 6 +++++- regamedll/dlls/game.cpp | 2 ++ regamedll/dlls/game.h | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08d627e4..4df82a68 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab | mp_free_armor | 0 | 0 | 2 | Give free armor on player spawn.
`0` disabled
`1` Give Kevlar
`2` Give Kevlar + Helmet | | 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 | ## How to install zBot for CS 1.6? diff --git a/dist/game.cfg b/dist/game.cfg index 2abc7fd2..175f8d80 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -455,3 +455,10 @@ mp_ct_default_weapons_secondary "usp" // // Default value: "0" mp_free_armor 0 + +// Players can receive all other players text chat, team restrictions apply. +// 0 - disabled (default behaviour) +// 1 - enabled +// +// Default value: "0" +sv_allchat 0 diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 58aff3d2..5ddf63ad 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -980,7 +980,11 @@ void Host_Say(edict_t *pEntity, BOOL teamonly) if (teamonly && pReceiver->m_iTeam != pPlayer->m_iTeam) continue; - if ((pReceiver->pev->deadflag != DEAD_NO && !bSenderDead) || (pReceiver->pev->deadflag == DEAD_NO && bSenderDead)) + if ( +#ifdef REGAMEDLL_ADD + !(bool)allchat.value && +#endif + ((pReceiver->pev->deadflag != DEAD_NO && !bSenderDead) || (pReceiver->pev->deadflag == DEAD_NO && bSenderDead))) { if (!(pPlayer->pev->flags & FL_PROXY)) continue; diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 0abecf17..dbe9b9ae 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -158,6 +158,7 @@ cvar_t t_give_player_knife = { "mp_t_give_player_knife", "1", 0, 1 cvar_t t_default_weapons_secondary = { "mp_t_default_weapons_secondary", "glock18", 0, 0.0f, nullptr }; cvar_t t_default_weapons_primary = { "mp_t_default_weapons_primary", "", 0, 0.0f, nullptr }; cvar_t free_armor = { "mp_free_armor", "0", 0, 0.0f, nullptr }; +cvar_t allchat = { "sv_allchat", "0", 0, 0.0f, nullptr }; void GameDLL_Version_f() { @@ -385,6 +386,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&t_default_weapons_secondary); CVAR_REGISTER(&t_default_weapons_primary); CVAR_REGISTER(&free_armor); + CVAR_REGISTER(&allchat); // print version CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 3f6d2d98..cc04e1c6 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -184,6 +184,7 @@ extern cvar_t t_give_player_knife; extern cvar_t t_default_weapons_secondary; extern cvar_t t_default_weapons_primary; extern cvar_t free_armor; +extern cvar_t allchat; #endif