[BotTargeting] Boredum too stronk.
This commit is contained in:
parent
97df90ed62
commit
7b4b8fee77
116
BotTargeting/scripting/BotTargeting.sp
Normal file
116
BotTargeting/scripting/BotTargeting.sp
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
#pragma semicolon 1
|
||||||
|
#pragma newdecls required
|
||||||
|
|
||||||
|
#include <sourcemod>
|
||||||
|
#include <BotTargeting>
|
||||||
|
|
||||||
|
bool g_bLateLoad = false;
|
||||||
|
bool g_bIsAutismBot[MAXPLAYERS+1] = { false, ... };
|
||||||
|
|
||||||
|
public Plugin myinfo =
|
||||||
|
{
|
||||||
|
name = "Bot Targeting",
|
||||||
|
author = "zaCade",
|
||||||
|
description = "Adds extra targeting methods",
|
||||||
|
version = "1.0"
|
||||||
|
};
|
||||||
|
|
||||||
|
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||||
|
{
|
||||||
|
g_bLateLoad = late;
|
||||||
|
|
||||||
|
CreateNative("IsClientAutismBot", Native_IsAutismBot);
|
||||||
|
|
||||||
|
RegPluginLibrary("BotTargetting");
|
||||||
|
return APLRes_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPluginStart()
|
||||||
|
{
|
||||||
|
AddMultiTargetFilter("@autismbots", Filter_AutismBot, "Autism Bots", false);
|
||||||
|
AddMultiTargetFilter("@!autismbots", Filter_NonAutismBot, "Non Autism Bots", false);
|
||||||
|
|
||||||
|
if(g_bLateLoad)
|
||||||
|
{
|
||||||
|
char sAuthID[32];
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i) && !IsFakeClient(i) && IsClientAuthorized(i) &&
|
||||||
|
GetClientAuthId(i, AuthId_Steam2, sAuthID, sizeof(sAuthID)))
|
||||||
|
{
|
||||||
|
OnClientAuthorized(i, sAuthID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPluginEnd()
|
||||||
|
{
|
||||||
|
RemoveMultiTargetFilter("@autismbots", Filter_AutismBot);
|
||||||
|
RemoveMultiTargetFilter("@!autismbots", Filter_NonAutismBot);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClientAuthorized(int client, const char[] sAuthID)
|
||||||
|
{
|
||||||
|
g_bIsAutismBot[client] = \
|
||||||
|
StrEqual(sAuthID, "STEAM_0:1:60189040") || \
|
||||||
|
StrEqual(sAuthID, "STEAM_0:0:204398871") || \
|
||||||
|
StrEqual(sAuthID, "STEAM_0:0:518094602") || \
|
||||||
|
StrEqual(sAuthID, "STEAM_0:0:610560766");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClientDisconnected(int client)
|
||||||
|
{
|
||||||
|
g_bIsAutismBot[client] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Filter_AutismBot(const char[] sPattern, Handle hClients, int client)
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i) && !IsFakeClient(i) && g_bIsAutismBot[i])
|
||||||
|
{
|
||||||
|
PushArrayCell(hClients, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Filter_NonAutismBot(const char[] sPattern, Handle hClients, int client)
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i) && !IsFakeClient(i) && !g_bIsAutismBot[i])
|
||||||
|
{
|
||||||
|
PushArrayCell(hClients, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Native_IsAutismBot(Handle hPlugin, int numParams)
|
||||||
|
{
|
||||||
|
int client = GetNativeCell(1);
|
||||||
|
|
||||||
|
if(client > MaxClients || client <= 0)
|
||||||
|
{
|
||||||
|
ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!IsClientInGame(client))
|
||||||
|
{
|
||||||
|
ThrowNativeError(SP_ERROR_NATIVE, "Client is not in-game.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!IsClientAuthorized(client))
|
||||||
|
{
|
||||||
|
ThrowNativeError(SP_ERROR_NATIVE, "Client is not authorized.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_bIsAutismBot[client];
|
||||||
|
}
|
24
BotTargeting/scripting/include/BotTargeting.inc
Normal file
24
BotTargeting/scripting/include/BotTargeting.inc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#if defined _BotTargeting_Included
|
||||||
|
#endinput
|
||||||
|
#endif
|
||||||
|
#define _BotTargeting_Included
|
||||||
|
|
||||||
|
native bool IsClientAutismBot(int client);
|
||||||
|
|
||||||
|
public SharedPlugin __pl_BotTargeting =
|
||||||
|
{
|
||||||
|
name = "BotTargeting",
|
||||||
|
file = "BotTargeting.smx",
|
||||||
|
#if defined REQUIRE_PLUGIN
|
||||||
|
required = 1,
|
||||||
|
#else
|
||||||
|
required = 0,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#if !defined REQUIRE_PLUGIN
|
||||||
|
public __pl_BotTargeting_SetNTVOptional()
|
||||||
|
{
|
||||||
|
MarkNativeAsOptional("IsClientAutismBot");
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user