Skip to content

Commit 4d54385

Browse files
CA_Gag: admin chat block enhancement with new CVar ca_gag_block_admin_chat (#185)
* increased number of admin chat commnads * added gag for block admin chat * fixed compile error
1 parent fcc30bd commit 4d54385

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,9 @@ ca_gag_sound_error "buttons/button2.wav"
6969
// -
7070
// Default: "1"
7171
ca_gag_block_nickname_change "1"
72+
73+
// Also block adminchat if admin gagged
74+
// 0 = no restrictions
75+
// -
76+
// Default: "1"
77+
ca_gag_block_admin_chat "1"

cstrike/addons/amxmodx/scripting/CA_Gag.sma

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ new ca_gag_times[64],
3131
ca_gag_remove_only_own_gag,
3232
ca_gag_sound_ok[128],
3333
ca_gag_sound_error[128],
34-
bool: ca_gag_block_nickname_change
34+
bool: ca_gag_block_nickname_change,
35+
bool: ca_gag_block_admin_chat
3536

3637
new g_dummy, g_itemInfo[64], g_itemName[128]
3738
enum {
@@ -44,6 +45,13 @@ new g_fwd_gag_setted,
4445
g_fwd_gag_removed,
4546
g_ret
4647

48+
new const g_adminChatCmds[][] = {
49+
"amx_say", "amx_asay", "amx_chat", "amx_psay",
50+
"amx_teamsay", "amx_bsay", "amx_bsay2", "amx_csay",
51+
"amx_csay2", "amx_rsay", "amx_rsay2", "amx_tsay",
52+
"amx_tsay2"
53+
}
54+
4755
public stock const PluginName[] = "CA: Gag"
4856
public stock const PluginVersion[] = CA_VERSION
4957
public stock const PluginAuthor[] = "Sergey Shorokhov"
@@ -97,8 +105,8 @@ public plugin_init() {
97105
register_clcmd("amx_gagmenu", "ClCmd_Gag", (accessFlags | accessFlagsHigh), .FlagManager = false)
98106
register_clcmd("say", "ClCmd_Say", (accessFlags | accessFlagsHigh), .FlagManager = false)
99107

100-
register_clcmd("amx_tsay", "ClCmd_adminSay", ADMIN_ALL)
101-
register_clcmd("amx_csay", "ClCmd_adminSay", ADMIN_ALL)
108+
for(new i; i < sizeof g_adminChatCmds; i++)
109+
register_clcmd(g_adminChatCmds[i], "ClCmd_adminSay", ADMIN_CHAT);
102110

103111
CA_Log(logLevel_Debug, "[CA]: Gag initialized!")
104112

@@ -187,6 +195,13 @@ Register_CVars() {
187195
),
188196
ca_gag_block_nickname_change
189197
)
198+
199+
bind_pcvar_num(create_cvar("ca_gag_block_admin_chat", "1",
200+
.description = "Also block adminchat if admin gagged\n \
201+
0 = no restrictions"
202+
),
203+
ca_gag_block_admin_chat
204+
)
190205
}
191206

192207
public client_putinserver(id) {
@@ -1263,7 +1278,7 @@ public CA_Client_ChangeName(const id, const newName[]) {
12631278

12641279
public ClCmd_adminSay(const id) {
12651280
new bool: hasBlock = (g_currentGags[id][gd_reason][r_flags] & gagFlag_Say)
1266-
if(!hasBlock) {
1281+
if(!hasBlock || !ca_gag_block_admin_chat) {
12671282
return CA_CONTINUE
12681283
}
12691284

0 commit comments

Comments
 (0)