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
This commit is contained in:
BotoX 2016-01-28 01:18:10 +01:00
parent f5ca547c96
commit e0741d6155
4 changed files with 14 additions and 8 deletions

View File

@ -21,5 +21,6 @@ public SharedPlugin:__pl_AdvancedTargeting =
public __pl_myfile_SetNTVOptional()
{
MarkNativeAsOptional("IsClientFriend");
MarkNativeAsOptional("ReadClientFriends");
}
#endif

View File

@ -25,6 +25,7 @@ public Plugin:myinfo =
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegAdminCmd("sm_hp", Command_Health, ADMFLAG_GENERIC, "sm_hp <#userid|name> <value>");
RegAdminCmd("sm_kevlar", Command_Kevlar, ADMFLAG_GENERIC, "sm_kevlar <#userid|name> <value>");
RegAdminCmd("sm_weapon", Command_Weapon, ADMFLAG_GENERIC, "sm_weapon <#userid|name> <name> [clip] [ammo]");

View File

@ -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

View File

@ -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);
}
}