Skip to content

Commit

Permalink
Improvements on !admin menu flags (#1364)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Mustafa Enes AKDENİZ authored and asherkin committed Oct 24, 2020
1 parent 18d93ff commit 94ea925
Showing 1 changed file with 48 additions and 18 deletions.
66 changes: 48 additions & 18 deletions plugins/basecomm/gag.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 94ea925

Please sign in to comment.