From 94ea925152c4381e83c05be0b174302d0567ff2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20Enes=20AKDEN=C4=B0Z?= <140202080@kocaeli.edu.tr> Date: Sat, 24 Oct 2020 20:22:02 +0300 Subject: [PATCH] Improvements on !admin menu flags (#1364) * Improvements on !admin menu flags Lets say we have override the sm_unmute command and changed it to ADMFLAG_CUSTOM1. Then create an admin, we gived our admin ADMFLAG_Chat flag, admin can't use sm_unmute command cause it doesnt have access to this command. But if admin go into "!admin" menu then, he will able to run sm_unmute on "player command" menus * removed unauthorized menu items * Deleted Whitespace and ITEMDRAW_DEFAULT --- plugins/basecomm/gag.sp | 66 ++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/plugins/basecomm/gag.sp b/plugins/basecomm/gag.sp index 150c2d23..31ae7ce3 100644 --- a/plugins/basecomm/gag.sp +++ b/plugins/basecomm/gag.sp @@ -53,29 +53,47 @@ void DisplayGagTypesMenu(int client) if (!playerstate[target].isMuted) { - AddTranslatedMenuItem(menu, "0", "Mute Player", client); + if(CheckCommandAccess(client, "sm_mute", ADMFLAG_CHAT, false)) + { + AddTranslatedMenuItem(menu, "0", "Mute Player", client); + } } else { - AddTranslatedMenuItem(menu, "1", "UnMute Player", client); + if(CheckCommandAccess(client, "sm_unmute", ADMFLAG_CHAT, false)) + { + AddTranslatedMenuItem(menu, "1", "UnMute Player", client); + } } if (!playerstate[target].isGagged) { - AddTranslatedMenuItem(menu, "2", "Gag Player", client); + if(CheckCommandAccess(client, "sm_gag", ADMFLAG_CHAT, false)) + { + AddTranslatedMenuItem(menu, "2", "Gag Player", client); + } } else { - AddTranslatedMenuItem(menu, "3", "UnGag Player", client); + if(CheckCommandAccess(client, "sm_ungag", ADMFLAG_CHAT, false)) + { + AddTranslatedMenuItem(menu, "3", "UnGag Player", client); + } } if (!playerstate[target].isMuted || !playerstate[target].isGagged) { - AddTranslatedMenuItem(menu, "4", "Silence Player", client); + if(CheckCommandAccess(client, "sm_silence", ADMFLAG_CHAT, false)) + { + AddTranslatedMenuItem(menu, "4", "Silence Player", client); + } } else { - AddTranslatedMenuItem(menu, "5", "UnSilence Player", client); + if(CheckCommandAccess(client, "sm_unsilence", ADMFLAG_CHAT, false)) + { + AddTranslatedMenuItem(menu, "5", "UnSilence Player", client); + } } menu.Display(client, MENU_TIME_FOREVER); @@ -186,33 +204,45 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa { case CommType_Mute: { - PerformMute(param1, target); - ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name); + if(CheckCommandAccess(param1, "sm_mute", ADMFLAG_CHAT, false)){ + PerformMute(param1, target); + ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name); + } } case CommType_UnMute: { - PerformUnMute(param1, target); - ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name); + if(CheckCommandAccess(param1, "sm_unmute", ADMFLAG_CHAT, false)){ + PerformUnMute(param1, target); + ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name); + } } case CommType_Gag: { - PerformGag(param1, target); - ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name); + if(CheckCommandAccess(param1, "sm_gag", ADMFLAG_CHAT, false)){ + PerformGag(param1, target); + ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name); + } } case CommType_UnGag: { - PerformUnGag(param1, target); - ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name); + if(CheckCommandAccess(param1, "sm_ungag", ADMFLAG_CHAT, false)){ + PerformUnGag(param1, target); + ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name); + } } case CommType_Silence: { - PerformSilence(param1, target); - ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name); + if(CheckCommandAccess(param1, "sm_silence", ADMFLAG_CHAT, false)){ + PerformSilence(param1, target); + ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name); + } } case CommType_UnSilence: { - PerformUnSilence(param1, target); - ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name); + if(CheckCommandAccess(param1, "sm_unsilence", ADMFLAG_CHAT, false)){ + PerformUnSilence(param1, target); + ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name); + } } } }