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
This commit is contained in:
Mustafa Enes AKDENİZ 2020-10-24 20:22:02 +03:00 committed by Asher Baker
parent 18d93ff677
commit 94ea925152

View File

@ -53,29 +53,47 @@ void DisplayGagTypesMenu(int client)
if (!playerstate[target].isMuted) 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 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) 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 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) 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 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); 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: case CommType_Mute:
{ {
PerformMute(param1, target); if(CheckCommandAccess(param1, "sm_mute", ADMFLAG_CHAT, false)){
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name); PerformMute(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
}
} }
case CommType_UnMute: case CommType_UnMute:
{ {
PerformUnMute(param1, target); if(CheckCommandAccess(param1, "sm_unmute", ADMFLAG_CHAT, false)){
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name); PerformUnMute(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
}
} }
case CommType_Gag: case CommType_Gag:
{ {
PerformGag(param1, target); if(CheckCommandAccess(param1, "sm_gag", ADMFLAG_CHAT, false)){
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name); PerformGag(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
}
} }
case CommType_UnGag: case CommType_UnGag:
{ {
PerformUnGag(param1, target); if(CheckCommandAccess(param1, "sm_ungag", ADMFLAG_CHAT, false)){
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name); PerformUnGag(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
}
} }
case CommType_Silence: case CommType_Silence:
{ {
PerformSilence(param1, target); if(CheckCommandAccess(param1, "sm_silence", ADMFLAG_CHAT, false)){
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name); PerformSilence(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
}
} }
case CommType_UnSilence: case CommType_UnSilence:
{ {
PerformUnSilence(param1, target); if(CheckCommandAccess(param1, "sm_unsilence", ADMFLAG_CHAT, false)){
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name); PerformUnSilence(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
}
} }
} }
} }