Command_SetDistance can be simplified to this:
PHP Code:
public Action:Command_SetDistance(client, args)
{
decl String:arg1[5];
GetCmdArg(1, arg1, sizeof(arg1));
distance[client] = FloatAbs(StringToFloat(arg1));
ReplyToCommand(client, "[SM] Set distance filter to: %f", distance[client]);
return Plugin_Handled;
}
You can also optimize this slightly, as you know exactly where the '!' would be, if it's present.
PHP Code:
new bool:opposite;
if(strPattern[1] == '!') opposite = true;
And this:
PHP Code:
if(!opposite)
{
if(vDistance <= distance[client]) PushArrayCell(hClients, i);
}
else
{
if(vDistance > distance[client]) PushArrayCell(hClients, i);
}
Can be changed to this (untested!!):
PHP Code:
if((vDistance <= distance[client]) == !opposite) PushArrayCell(hClients, i);
__________________