Skip to content

Commit d74ba75

Browse files
Add CVar ca_gag_own_reason_enabled in CA GAG (#266)
* gag: added CVar `ca_gag_own_reason_enabled` * gag: add CVar `ca_gag_own_reason_enabled` in config
1 parent b397a99 commit d74ba75

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
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
@@ -82,4 +82,12 @@ ca_gag_block_admin_chat "1"
8282
// Default: "1"
8383
ca_gag_common_chat_block "1"
8484

85+
// Enable own gag reason
86+
// 0 = disabled (excluding when there are no reasons)
87+
// 1 = enabled, at first position in reasons list
88+
// 2 = enabled, at last position in reasons list
89+
// -
90+
// Default: "1"
91+
ca_gag_own_reason_enabled "1"
92+
8593

cstrike/addons/amxmodx/scripting/CA_Gag.sma

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ new ca_gag_times[64],
3333
ca_gag_sound_error[128],
3434
bool: ca_gag_block_nickname_change,
3535
bool: ca_gag_block_admin_chat,
36-
bool: ca_gag_common_chat_block
36+
bool: ca_gag_common_chat_block,
37+
ca_gag_own_reason_enabled
3738

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

@@ -216,6 +217,15 @@ Register_CVars() {
216217
),
217218
ca_gag_common_chat_block
218219
)
220+
221+
bind_pcvar_num(create_cvar("ca_gag_own_reason_enabled", "1",
222+
.description = "Enable own gag reason\n \
223+
0 = disabled (excluding when there are no reasons)\n \
224+
1 = enabled, at first position in reasons list\n \
225+
2 = enabled, at last position in reasons list"
226+
),
227+
ca_gag_own_reason_enabled
228+
)
219229
}
220230

221231
public client_putinserver(id) {
@@ -409,7 +419,7 @@ static MenuShow_SelectReason(const id) {
409419

410420
new bool: hasReasonsTemplates = bool: (g_gagReasonsTemplates_size != 0)
411421

412-
if(playerFlags & (accessFlagsHigh | accessFlagsOwnReason) || !hasReasonsTemplates) {
422+
if(ca_gag_own_reason_enabled == 1 && playerFlags & (accessFlagsHigh | accessFlagsOwnReason) || !hasReasonsTemplates) {
413423
menu_additem(menu, fmt("%L\n", id, "Gag_EnterReason"), fmt("%i", ITEM_ENTER_GAG_REASON))
414424
}
415425

@@ -445,6 +455,10 @@ static MenuShow_SelectReason(const id) {
445455

446456
menu_additem(menu, buffer, fmt("%i", i))
447457
}
458+
459+
if(ca_gag_own_reason_enabled == 2 && playerFlags & (accessFlagsHigh | accessFlagsOwnReason)) {
460+
menu_additem(menu, fmt("%L\n", id, "Gag_EnterReason"), fmt("%i", ITEM_ENTER_GAG_REASON))
461+
}
448462
} else {
449463
menu_addtext(menu, fmt("\\d %L", id, "Gag_NoTemplatesAvailable_Reasons"), .slot = false)
450464
}

0 commit comments

Comments
 (0)