From af700813b92945158323de0914eb1611d6347b1c Mon Sep 17 00:00:00 2001 From: Dogan Date: Mon, 10 Jun 2019 14:50:12 +0200 Subject: [PATCH] AdvancedTargeting: add @alivect + @alivet --- .../scripting/AdvancedTargeting.sp | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/AdvancedTargeting/scripting/AdvancedTargeting.sp b/AdvancedTargeting/scripting/AdvancedTargeting.sp index 130bf0de..f602ffc8 100644 --- a/AdvancedTargeting/scripting/AdvancedTargeting.sp +++ b/AdvancedTargeting/scripting/AdvancedTargeting.sp @@ -13,7 +13,7 @@ Handle g_FriendsArray[MAXPLAYERS + 1] = {INVALID_HANDLE, ...}; bool g_bLateLoad = false; -#include "SteamAPI.secret" //#define STEAM_API_KEY here +#include //#define STEAM_API_KEY here public Plugin myinfo = { @@ -33,6 +33,8 @@ public void OnPluginStart() AddMultiTargetFilter("@random", Filter_Random, "a Random Player", false); AddMultiTargetFilter("@randomct", Filter_RandomCT, "a Random CT", false); AddMultiTargetFilter("@randomt", Filter_RandomT, "a Random T", false); + AddMultiTargetFilter("@alivect", Filter_AliveCT, "Alive Humans", false); + AddMultiTargetFilter("@alivet", Filter_AliveT, "Alive Zombies", false); RegConsoleCmd("sm_admins", Command_Admins, "Currently online admins."); RegConsoleCmd("sm_friends", Command_Friends, "Currently online friends."); @@ -60,6 +62,8 @@ public void OnPluginEnd() RemoveMultiTargetFilter("@random", Filter_Random); RemoveMultiTargetFilter("@randomct", Filter_RandomCT); RemoveMultiTargetFilter("@randomt", Filter_RandomT); + RemoveMultiTargetFilter("@alivect", Filter_AliveCT); + RemoveMultiTargetFilter("@alivet", Filter_AliveT); } public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) @@ -136,6 +140,32 @@ public Action Command_Friends(int client, int args) return Plugin_Handled; } +public bool Filter_AliveCT(const char[] sPattern, Handle hClients, int client) +{ + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == CS_TEAM_CT && IsPlayerAlive(i)) + { + PushArrayCell(hClients, i); + } + } + + return true; +} + +public bool Filter_AliveT(const char[] sPattern, Handle hClients, int client) +{ + for(int i = 1; i <= MaxClients; i++) + { + if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == CS_TEAM_T && IsPlayerAlive(i)) + { + PushArrayCell(hClients, i); + } + } + + return true; +} + public bool Filter_Admin(const char[] sPattern, Handle hClients, int client) { for(int i = 1; i <= MaxClients; i++)