Skip to content

Commit bafdbf1

Browse files
authored
new CVar: ca_gag_common_chat_block (#242)
* new CVar: `ca_gag_common_chat_block` * use it * remove say team from notify * fix compile
1 parent 5a1e004 commit bafdbf1

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

cstrike/addons/amxmodx/configs/plugins/ChatAdditions/CA_Gag.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,11 @@ ca_gag_block_nickname_change "1"
7575
// -
7676
// Default: "1"
7777
ca_gag_block_admin_chat "1"
78+
79+
// Don't separate `say` & `say_team` chats
80+
// 0 = disabled
81+
// -
82+
// Default: "1"
83+
ca_gag_common_chat_block "1"
84+
85+

cstrike/addons/amxmodx/scripting/CA_Gag.sma

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ new ca_gag_times[64],
3232
ca_gag_sound_ok[128],
3333
ca_gag_sound_error[128],
3434
bool: ca_gag_block_nickname_change,
35-
bool: ca_gag_block_admin_chat
35+
bool: ca_gag_block_admin_chat,
36+
bool: ca_gag_common_chat_block
3637

3738
new g_dummy, g_itemInfo[64], g_itemName[128]
3839

@@ -207,6 +208,13 @@ Register_CVars() {
207208
),
208209
ca_gag_block_admin_chat
209210
)
211+
212+
bind_pcvar_num(create_cvar("ca_gag_common_chat_block", "1",
213+
.description = "Don't separate `say` & `say_team` chats\n \
214+
0 = disabled"
215+
),
216+
ca_gag_common_chat_block
217+
)
210218
}
211219

212220
public client_putinserver(id) {
@@ -638,10 +646,12 @@ static MenuShow_SelectFlags(const id) {
638646
(gagFlags & gagFlag_Say) ? " \\r+\\w " : "-"),
639647
fmt("%i", gagFlag_Say)
640648
)
641-
menu_additem(menu, fmt("%L [ %s ]", id, "Gag_MenuItem_PropSayTeam",
642-
(gagFlags & gagFlag_SayTeam) ? " \\r+\\w " : "-"),
643-
fmt("%i", gagFlag_SayTeam)
644-
)
649+
if(!ca_gag_common_chat_block) {
650+
menu_additem(menu, fmt("%L [ %s ]", id, "Gag_MenuItem_PropSayTeam",
651+
(gagFlags & gagFlag_SayTeam) ? " \\r+\\w " : "-"),
652+
fmt("%i", gagFlag_SayTeam)
653+
)
654+
}
645655
menu_additem(menu, fmt("%L [ %s ]", id, "Gag_MenuItem_PropVoice",
646656
(gagFlags & gagFlag_Voice) ? " \\r+\\w " : "-"),
647657
fmt("%i", gagFlag_Voice)
@@ -718,7 +728,9 @@ public MenuHandler_SelectFlags(const id, const menu, const item) {
718728
new itemIndex = strtol(g_itemInfo)
719729

720730
switch(itemIndex) {
721-
case gagFlag_Say: g_adminTempData[id][gd_reason][r_flags] ^= gagFlag_Say
731+
case gagFlag_Say: {
732+
g_adminTempData[id][gd_reason][r_flags] ^= (!ca_gag_common_chat_block ? gagFlag_Say : (gagFlag_Say | gagFlag_SayTeam))
733+
}
722734
case gagFlag_SayTeam: g_adminTempData[id][gd_reason][r_flags] ^= gagFlag_SayTeam
723735
case gagFlag_Voice: g_adminTempData[id][gd_reason][r_flags] ^= gagFlag_Voice
724736

@@ -910,11 +922,15 @@ static MenuShow_EditGag(const id) {
910922
),
911923
fmt("%i", gagFlag_Say)
912924
)
913-
menu_additem(menu, fmt("%L [ %s ]", id, "Gag_MenuItem_PropSayTeam",
914-
(gagFlags & gagFlag_SayTeam) ? " \\r+\\w " : "-"
915-
),
916-
fmt("%i", gagFlag_SayTeam)
917-
)
925+
926+
if(!ca_gag_common_chat_block) {
927+
menu_additem(menu, fmt("%L [ %s ]", id, "Gag_MenuItem_PropSayTeam",
928+
(gagFlags & gagFlag_SayTeam) ? " \\r+\\w " : "-"
929+
),
930+
fmt("%i", gagFlag_SayTeam)
931+
)
932+
}
933+
918934
menu_additem(menu, fmt("%L [ %s ]", id, "Gag_MenuItem_PropVoice",
919935
(gagFlags & gagFlag_Voice) ? " \\r+\\w " : "-"
920936
),
@@ -1299,7 +1315,7 @@ public CA_Client_SayTeam(id, const message[]) {
12991315
if(CmdRouter(id, message))
13001316
return PLUGIN_CONTINUE
13011317

1302-
new bool: hasBlock = (g_currentGags[id][gd_reason][r_flags] & gagFlag_SayTeam)
1318+
new bool: hasBlock = bool: (g_currentGags[id][gd_reason][r_flags] & (ca_gag_common_chat_block ? gagFlag_SayTeam : gagFlag_Say))
13031319

13041320
if(!hasBlock) {
13051321
return CA_CONTINUE
@@ -1542,14 +1558,17 @@ static bool: IsTargetHasImmunity(const id, const target) {
15421558
return false
15431559
}
15441560

1545-
static Get_GagFlags_Names(const gag_flags_s: flags) {
1561+
static Get_GagFlags_Names(gag_flags_s: flags) {
15461562
// TODO: ML this
15471563

15481564
new buffer[64]
15491565
new const GAG_FLAGS_STR[][] = {
15501566
"Chat", "Team chat", "Voice"
15511567
}
15521568

1569+
if(ca_gag_common_chat_block && (flags & gagFlag_SayTeam))
1570+
flags ^= gagFlag_SayTeam
1571+
15531572
for(new i = 0; i < sizeof(GAG_FLAGS_STR); i++) {
15541573
if(flags & gag_flags_s: (1 << i)) {
15551574
strcat(buffer, fmt("%s + ", GAG_FLAGS_STR[i]), charsmax(buffer));

0 commit comments

Comments
 (0)