entwatch: ambigious targeting

This commit is contained in:
neon 2018-08-06 13:59:28 +02:00
parent dc0efb0327
commit 4cdea05237

View File

@ -1738,12 +1738,25 @@ public Action:Command_Restrict(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
new String:target_argument[64]; char sArgs[64];
GetCmdArg(1, target_argument, sizeof(target_argument)); char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
new target = -1; GetCmdArg(1, sArgs, sizeof(sArgs));
if ((target = FindTarget(client, target_argument, true)) == -1)
if ((iTargetCount = ProcessTargetString(
sArgs,
client,
iTargets,
MAXPLAYERS,
COMMAND_FILTER_NO_BOTS,
sTargetName,
sizeof(sTargetName),
bIsML)) <= 0)
{ {
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled; return Plugin_Handled;
} }
@ -1757,19 +1770,19 @@ public Action:Command_Restrict(client, args)
if (StringToInt(sLen) == 0) if (StringToInt(sLen) == 0)
{ {
EBanClient(target, "1", client); EBanClient(iTargets[0], "1", client);
return Plugin_Handled; return Plugin_Handled;
} }
else if (StringToInt(sLen) > 0) else if (StringToInt(sLen) > 0)
{ {
EBanClient(target, Flength, client); EBanClient(iTargets[0], Flength, client);
} }
return Plugin_Handled; return Plugin_Handled;
} }
EBanClient(target, "0", client); EBanClient(iTargets[0], "0", client);
return Plugin_Handled; return Plugin_Handled;
} }