Added client id to MultiTargetFilter forward.

This commit is contained in:
BotoX 2019-09-25 20:17:49 +02:00
parent 86fbf20a85
commit 0c147446d5
2 changed files with 21 additions and 1 deletions

View File

@ -64,10 +64,13 @@ static const int kActivityAdmins = 4; // Show admin activity to admins anonymo
static const int kActivityAdminsNames = 8; // If 4 is specified, admin names will be shown. static const int kActivityAdminsNames = 8; // If 4 is specified, admin names will be shown.
static const int kActivityRootNames = 16; // Always show admin names to root users. static const int kActivityRootNames = 16; // Always show admin names to root users.
#define FEATURECAP_MULTITARGETFILTER_CLIENTPARAM "SourceMod MultiTargetFilter ClientParam"
class PlayerLogicHelpers : class PlayerLogicHelpers :
public SMGlobalClass, public SMGlobalClass,
public IPluginsListener, public IPluginsListener,
public ICommandTargetProcessor public ICommandTargetProcessor,
public IFeatureProvider
{ {
struct SimpleMultiTargetFilter struct SimpleMultiTargetFilter
{ {
@ -141,6 +144,7 @@ public: //ICommandTargetProcessor
smtf->fun->PushString(info->pattern); smtf->fun->PushString(info->pattern);
smtf->fun->PushCell(ahc.getClone()); smtf->fun->PushCell(ahc.getClone());
smtf->fun->PushCell(info->admin);
cell_t result = 0; cell_t result = 0;
if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result) if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result)
return false; return false;
@ -185,6 +189,7 @@ public: //SMGlobalClass
void OnSourceModAllInitialized() void OnSourceModAllInitialized()
{ {
pluginsys->AddPluginsListener(this); pluginsys->AddPluginsListener(this);
sharesys->AddCapabilityProvider(NULL, this, FEATURECAP_MULTITARGETFILTER_CLIENTPARAM);
} }
void OnSourceModShutdown() void OnSourceModShutdown()
@ -194,6 +199,7 @@ public: //SMGlobalClass
playerhelpers->UnregisterCommandTargetProcessor(this); playerhelpers->UnregisterCommandTargetProcessor(this);
filterEnabled = false; filterEnabled = false;
} }
sharesys->DropCapabilityProvider(NULL, this, FEATURECAP_MULTITARGETFILTER_CLIENTPARAM);
} }
public: //IPluginsListener public: //IPluginsListener
@ -211,6 +217,13 @@ public: //IPluginsListener
} }
} }
} }
public: //IFeatureProvider
FeatureStatus GetFeatureStatus(FeatureType type, const char *name)
{
return FeatureStatus_Available;
}
} s_PlayerLogicHelpers; } s_PlayerLogicHelpers;
static cell_t static cell_t

View File

@ -132,16 +132,23 @@ stock void ReplyToTargetError(int client, int reason)
} }
} }
#define FEATURECAP_MULTITARGETFILTER_CLIENTPARAM "SourceMod MultiTargetFilter ClientParam"
/** /**
* Adds clients to a multi-target filter. * Adds clients to a multi-target filter.
* *
* @param pattern Pattern name. * @param pattern Pattern name.
* @param clients Array to fill with unique, valid client indexes. * @param clients Array to fill with unique, valid client indexes.
* @param client Client that triggered this filter.
* @return True if pattern was recognized, false otherwise. * @return True if pattern was recognized, false otherwise.
*
* @note To see if the client param is available, use FeatureType_Capability and FEATURECAP_MULTITARGETFILTER_CLIENTPARAM.
*/ */
typeset MultiTargetFilter { typeset MultiTargetFilter {
function bool (const char[] pattern, Handle clients); function bool (const char[] pattern, Handle clients);
function bool (const char[] pattern, ArrayList clients); function bool (const char[] pattern, ArrayList clients);
function bool (const char[] pattern, Handle clients, int client);
function bool (const char[] pattern, ArrayList clients, int client);
} }
/** /**