Or, you could just use
ProcessTargetString, which is what FindTarget calls internally.
Edit: For an example of how to use it:
PHP Code:
// Somewhere earlier on, such as OnPluginStart
LoadTranslations("common.phrases");
public Action Command_SelectTarget( int client, int args )
{
// Note: We changed this char length; this is defined in commandfilters.inc
char target[MAX_TARGET_LENGTH];
GetCmdArgString( target, sizeof(target) );
int displayTo[MaxClients];
// Since this is intended to display a menu:
// Filters say to ignore admin immunity levels and also not select bots
int count = ProcessTargetString(target, client, displayTo, sizeof(displayTo), COMMAND_FILTER_NO_IMMUNITY|COMMAND_FILTER_NO_BOTS);
if (count < 1)
{
// This handles "target not found" and the like
ReplyToTargetError(client, count);
return Plugin_Handled;
}
// displayTo[0] through displayTo[count-1] now contain client indexes of all matching clients that you can iterate through using a for loop
for (int i = 0; i < count; i++)
{
// Do something with displayTo[i]
PrintToChat( displayTo[i], "[SM] This is boring and uses a for loop instead of a callback :(" );
}
return Plugin_Handled;
}
__________________