From e0741d61553efb91aa481bf825c7309657ae22db Mon Sep 17 00:00:00 2001 From: BotoX Date: Thu, 28 Jan 2016 01:18:10 +0100 Subject: [PATCH] PointServerCommandFilter: fixed negative value bug nominations_extended: fixed nominate_addmap menu ExtraCommands: fixed "no matching client was found" message AdvancedTargeting: fixed missing MarkNativeAsOptional in include --- .../scripting/include/AdvancedTargeting.inc | 1 + ExtraCommands/scripting/ExtraCommands.sp | 1 + .../scripting/PointServerCommandFilter.sp | 11 +++++++---- mapchooser_extended/scripting/nominations_extended.sp | 9 +++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/AdvancedTargeting/scripting/include/AdvancedTargeting.inc b/AdvancedTargeting/scripting/include/AdvancedTargeting.inc index 4e4cb088..85d3c5bb 100644 --- a/AdvancedTargeting/scripting/include/AdvancedTargeting.inc +++ b/AdvancedTargeting/scripting/include/AdvancedTargeting.inc @@ -21,5 +21,6 @@ public SharedPlugin:__pl_AdvancedTargeting = public __pl_myfile_SetNTVOptional() { MarkNativeAsOptional("IsClientFriend"); + MarkNativeAsOptional("ReadClientFriends"); } #endif diff --git a/ExtraCommands/scripting/ExtraCommands.sp b/ExtraCommands/scripting/ExtraCommands.sp index b73ece6e..a680a27f 100644 --- a/ExtraCommands/scripting/ExtraCommands.sp +++ b/ExtraCommands/scripting/ExtraCommands.sp @@ -25,6 +25,7 @@ public Plugin:myinfo = public OnPluginStart() { + LoadTranslations("common.phrases"); RegAdminCmd("sm_hp", Command_Health, ADMFLAG_GENERIC, "sm_hp <#userid|name> "); RegAdminCmd("sm_kevlar", Command_Kevlar, ADMFLAG_GENERIC, "sm_kevlar <#userid|name> "); RegAdminCmd("sm_weapon", Command_Weapon, ADMFLAG_GENERIC, "sm_weapon <#userid|name> [clip] [ammo]"); diff --git a/PointServerCommandFilter/scripting/PointServerCommandFilter.sp b/PointServerCommandFilter/scripting/PointServerCommandFilter.sp index 62485257..55159870 100644 --- a/PointServerCommandFilter/scripting/PointServerCommandFilter.sp +++ b/PointServerCommandFilter/scripting/PointServerCommandFilter.sp @@ -37,7 +37,7 @@ public Plugin myinfo = name = "PointServerCommandFilter", author = "BotoX", description = "Filters point_servercommand->Command() using user-defined rules to restrict maps.", - version = "0.1", + version = "1.0", url = "" }; @@ -55,7 +55,10 @@ public Action PointServerCommandForward(const char[] sOrigCommand) int Split = SplitString(sCommandRight, " ", sCommandLeft, sizeof(sCommandLeft)); if(Split == -1) + { strcopy(sCommandLeft, sizeof(sCommandLeft), sCommandRight); + Split = 0; + } TrimString(sCommandLeft); strcopy(sCommandRight, sizeof(sCommandRight), sCommandRight[Split]); @@ -88,6 +91,7 @@ Action MatchRuleList(ArrayList RuleList, const char[] sOrigCommand, const char[] StringMap Rule = RuleList.Get(r); int Mode; Rule.GetValue("mode", Mode); + bool IsNumeric = IsCharNumeric(sCommandRight[0]) || (sCommandRight[0] == '-' && IsCharNumeric(sCommandRight[1])); if(Mode & MODE_ALL) State |= STATE_ALLOW; @@ -105,7 +109,7 @@ Action MatchRuleList(ArrayList RuleList, const char[] sOrigCommand, const char[] Rule.GetValue("value", WantValue); IsValue = StringToInt(sCommandRight); - if(IsCharNumeric(sCommandRight[0]) && WantValue == IsValue) + if(IsNumeric && WantValue == IsValue) State |= STATE_ALLOW; } else if(Mode & MODE_FLOATVALUE) @@ -115,7 +119,7 @@ Action MatchRuleList(ArrayList RuleList, const char[] sOrigCommand, const char[] Rule.GetValue("value", WantValue); IsValue = StringToFloat(sCommandRight); - if(IsCharNumeric(sCommandRight[0]) && FloatCompare(IsValue, WantValue) == 0) + if(IsNumeric && FloatCompare(IsValue, WantValue) == 0) State |= STATE_ALLOW; } else if(Mode & MODE_REGEXVALUE) @@ -129,7 +133,6 @@ Action MatchRuleList(ArrayList RuleList, const char[] sOrigCommand, const char[] float MinValue; float MaxValue; float IsValue = StringToFloat(sCommandRight); - bool IsNumeric = IsCharNumeric(sCommandRight[0]); if(!IsNumeric && (Mode & MODE_MIN || Mode & MODE_MAX)) continue; // Ignore non-numerical diff --git a/mapchooser_extended/scripting/nominations_extended.sp b/mapchooser_extended/scripting/nominations_extended.sp index af6cbe52..ad8fb845 100644 --- a/mapchooser_extended/scripting/nominations_extended.sp +++ b/mapchooser_extended/scripting/nominations_extended.sp @@ -679,13 +679,14 @@ public Handler_AdminMapSelectMenu(Handle:menu, MenuAction:action, param1, param2 { case MenuAction_Select: { - decl String:map[PLATFORM_MAX_PATH], String:name[MAX_NAME_LENGTH]; + decl String:map[PLATFORM_MAX_PATH]; GetMenuItem(menu, param2, map, sizeof(map)); - new NominateResult:result = NominateMap(map, false, 0); + new NominateResult:result = NominateMap(map, true, 0); - if (result == Nominate_AlreadyInVote) + if (result > Nominate_Replaced) { + /* We assume already in vote is the casue because the maplist does a Map Validity check and we forced, so it can't be full */ PrintToChat(param1, "[NE] %t", "Map Already In Vote", map); return 0; } @@ -695,7 +696,7 @@ public Handler_AdminMapSelectMenu(Handle:menu, MenuAction:action, param1, param2 PrintToChat(param1, "[NE] %t", "Map Inserted", map); LogAction(param1, -1, "\"%L\" inserted map \"%s\".", param1, map); - PrintToChatAll("[NE] %N has inserted %s into nominations", name, map); + PrintToChatAll("[NE] %N has inserted %s into nominations", param1, map); } }