From 0c147446d5892be9be63d964989926f7eb4af6f1 Mon Sep 17 00:00:00 2001 From: BotoX Date: Wed, 25 Sep 2019 20:17:49 +0200 Subject: [PATCH] Added client id to MultiTargetFilter forward. --- core/logic/smn_players.cpp | 15 ++++++++++++++- plugins/include/commandfilters.inc | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/logic/smn_players.cpp b/core/logic/smn_players.cpp index 17e2262f..4fdb5304 100644 --- a/core/logic/smn_players.cpp +++ b/core/logic/smn_players.cpp @@ -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 kActivityRootNames = 16; // Always show admin names to root users. +#define FEATURECAP_MULTITARGETFILTER_CLIENTPARAM "SourceMod MultiTargetFilter ClientParam" + class PlayerLogicHelpers : public SMGlobalClass, public IPluginsListener, - public ICommandTargetProcessor + public ICommandTargetProcessor, + public IFeatureProvider { struct SimpleMultiTargetFilter { @@ -141,6 +144,7 @@ public: //ICommandTargetProcessor smtf->fun->PushString(info->pattern); smtf->fun->PushCell(ahc.getClone()); + smtf->fun->PushCell(info->admin); cell_t result = 0; if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result) return false; @@ -185,6 +189,7 @@ public: //SMGlobalClass void OnSourceModAllInitialized() { pluginsys->AddPluginsListener(this); + sharesys->AddCapabilityProvider(NULL, this, FEATURECAP_MULTITARGETFILTER_CLIENTPARAM); } void OnSourceModShutdown() @@ -194,6 +199,7 @@ public: //SMGlobalClass playerhelpers->UnregisterCommandTargetProcessor(this); filterEnabled = false; } + sharesys->DropCapabilityProvider(NULL, this, FEATURECAP_MULTITARGETFILTER_CLIENTPARAM); } public: //IPluginsListener @@ -211,6 +217,13 @@ public: //IPluginsListener } } } + +public: //IFeatureProvider + + FeatureStatus GetFeatureStatus(FeatureType type, const char *name) + { + return FeatureStatus_Available; + } } s_PlayerLogicHelpers; static cell_t diff --git a/plugins/include/commandfilters.inc b/plugins/include/commandfilters.inc index 4b324a33..9a658a92 100644 --- a/plugins/include/commandfilters.inc +++ b/plugins/include/commandfilters.inc @@ -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. * * @param pattern Pattern name. * @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. + * + * @note To see if the client param is available, use FeatureType_Capability and FEATURECAP_MULTITARGETFILTER_CLIENTPARAM. */ typeset MultiTargetFilter { function bool (const char[] pattern, Handle 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); } /**