Added ProcessTargetString simple filter API (bug 4404, r=ds).
This commit is contained in:
@@ -132,3 +132,34 @@ stock ReplyToTargetError(client, reason)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds clients to a multi-target filter.
|
||||
*
|
||||
* @param pattern Pattern name.
|
||||
* @param clients Array to fill with unique, valid client indexes.
|
||||
* @return True if pattern was recognized, false otherwise.
|
||||
*/
|
||||
functag public bool:MultiTargetFilter(const String:pattern[], Handle:clients);
|
||||
|
||||
/**
|
||||
* Adds a multi-target filter function for ProcessTargetString().
|
||||
*
|
||||
* @param pattern Pattern to match (case sensitive).
|
||||
* @param filter Filter function.
|
||||
* @param phrase Descriptive phrase to display on successful match.
|
||||
* @param phraseIsML True if phrase is multi-lingual, false otherwise.
|
||||
* @noreturn
|
||||
*/
|
||||
native AddMultiTargetFilter(const String:pattern[], MultiTargetFilter:filter,
|
||||
const String:phrase[], bool:phraseIsML);
|
||||
|
||||
/**
|
||||
* Removes a multi-target filter function from ProcessTargetString().
|
||||
*
|
||||
* @param pattern Pattern to match (case sensitive).
|
||||
* @param filter Filter function.
|
||||
* @noreturn
|
||||
*/
|
||||
native RemoveMultiTargetFilter(const String:pattern[], MultiTargetFilter:filter);
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#include <sourcemod>
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "Test target filters",
|
||||
author = "AlliedModders LLC",
|
||||
description = "Tests target filters",
|
||||
version = "1.0.0.0",
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
AddMultiTargetFilter("@crab", filter, "all players", true)
|
||||
}
|
||||
|
||||
public bool:filter(const String:pattern[], Handle:clients)
|
||||
{
|
||||
for (new i = 1; i <= MaxClients; i++) {
|
||||
if (IsPlayerInGame(i))
|
||||
PushArrayCell(clients, i)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user