From d1555374be34f1de0b3ee944e662055c99094b5b Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 23 Sep 2018 23:53:59 +0200 Subject: [PATCH] =?UTF-8?q?(=C2=AC=E2=80=BF=C2=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripting/include/mapchooser_extended.inc | 2 +- .../scripting/mapchooser_extended.sp | 15 ++++++++++++++- .../scripting/nominations_extended.sp | 6 +++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/mapchooser_extended/scripting/include/mapchooser_extended.inc b/mapchooser_extended/scripting/include/mapchooser_extended.inc index f8f8e849..44eda04e 100644 --- a/mapchooser_extended/scripting/include/mapchooser_extended.inc +++ b/mapchooser_extended/scripting/include/mapchooser_extended.inc @@ -130,7 +130,7 @@ native int GetMapGroups(const char[] map, int[] groups, int size); // >=0 = Group _max -> Group full native int GetMapGroupRestriction(const char[] map, int client = 0); -native bool GetMapVIPRestriction(const char[] map); +native bool GetMapVIPRestriction(const char[] map, int client = 0); public SharedPlugin __pl_mapchooser_extended = { diff --git a/mapchooser_extended/scripting/mapchooser_extended.sp b/mapchooser_extended/scripting/mapchooser_extended.sp index f52eea88..ab67148e 100644 --- a/mapchooser_extended/scripting/mapchooser_extended.sp +++ b/mapchooser_extended/scripting/mapchooser_extended.sp @@ -1526,7 +1526,7 @@ public int Handler_MapVoteMenu(Handle menu, MenuAction action, int param1, int p { Format(buffer, sizeof(buffer), "%T", "Custom", param1, map); } - else if(GetMapVIPRestriction(map)) + else if(InternalGetMapVIPRestriction(map)) { Format(buffer, sizeof(buffer), "%s (%T)", map, "VIP Nomination", param1); } @@ -2306,6 +2306,7 @@ public int Native_GetMapGroupRestriction(Handle plugin, int numParams) public int Native_GetMapVIPRestriction(Handle plugin, int numParams) { + int client = GetNativeCell(2); int len; GetNativeStringLength(1, len); @@ -2315,6 +2316,18 @@ public int Native_GetMapVIPRestriction(Handle plugin, int numParams) char[] map = new char[len+1]; GetNativeString(1, map, len+1); + // Check if client should bypass vip restrictions + if(client > 0 && client < MaxClients) + { + // Client has bypass flag, dont return vip restrictions + if(CheckCommandAccess(client, "sm_nominate_ignore", ADMFLAG_CHEATS)) + return false; + + // Client has vip flag, dont return vip restrictions + if(CheckCommandAccess(client, "sm_nominate_vip", ADMFLAG_CUSTOM1)) + return false; + } + return InternalGetMapVIPRestriction(map); } diff --git a/mapchooser_extended/scripting/nominations_extended.sp b/mapchooser_extended/scripting/nominations_extended.sp index d80cb3a6..0c8b1148 100644 --- a/mapchooser_extended/scripting/nominations_extended.sp +++ b/mapchooser_extended/scripting/nominations_extended.sp @@ -510,8 +510,8 @@ public Action Command_Nominate(int client, int args) return Plugin_Handled; } - bool VIPRestriction = GetMapVIPRestriction(mapname); - if((VIPRestriction) && !(CheckCommandAccess(client, "sm_tag", ADMFLAG_CUSTOM1) || CheckCommandAccess(client, "sm_kick", ADMFLAG_KICK))) + bool VIPRestriction = GetMapVIPRestriction(mapname, client); + if(VIPRestriction) { CPrintToChat(client, "[NE] %t", "Map Nominate VIP Error"); @@ -790,7 +790,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) return ITEMDRAW_DISABLED; - if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || (GetMapVIPRestriction(map) && !(CheckCommandAccess(param1, "sm_tag", ADMFLAG_CUSTOM1) || CheckCommandAccess(param1, "sm_kick", ADMFLAG_KICK)))) + if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map, param1)) return ITEMDRAW_DISABLED; return ITEMDRAW_DEFAULT;