AdvancedTargeting: add @alivect + @alivet

This commit is contained in:
Dogan 2019-06-10 14:50:12 +02:00
parent 03a443a30a
commit af700813b9

View File

@ -13,7 +13,7 @@
Handle g_FriendsArray[MAXPLAYERS + 1] = {INVALID_HANDLE, ...};
bool g_bLateLoad = false;
#include "SteamAPI.secret" //#define STEAM_API_KEY here
#include <SteamAPI.secret> //#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++)