sloppy AI update to just add extra native giving the index of 1-4 for the autismbots

This commit is contained in:
jenz
2026-10-09 12:54:23 +02:00
parent 82d16c163a
commit a771e8633f
2 changed files with 62 additions and 16 deletions
+48 -16
View File
@@ -6,13 +6,24 @@
bool g_bLateLoad = false;
bool g_bIsAutismBot[MAXPLAYERS+1] = { false, ... };
int g_iAutismBotIndex[MAXPLAYERS+1] = { 0, ... }; // 0 = not an autism bot, 1-4 = autism bot index
// The position in this list is the autism bot index (first entry = 1).
// The index decides which UDP port the connection plugin talks to, so keep this order.
char g_sAutismBotAuthIDs[][] =
{
"STEAM_0:1:60189040", // autism bot 1
"STEAM_0:0:518094602", // autism bot 2
"STEAM_0:0:204398871", // autism bot 3
"STEAM_0:0:610560766" // autism bot 4
};
public Plugin myinfo =
{
name = "Bot Targeting",
author = "zaCade",
description = "Adds extra targeting methods",
version = "1.0"
version = "1.1"
};
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
@@ -20,6 +31,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
g_bLateLoad = late;
CreateNative("IsClientAutismBot", Native_IsAutismBot);
CreateNative("GetClientAutismBotIndex", Native_GetAutismBotIndex);
RegPluginLibrary("BotTargeting");
return APLRes_Success;
@@ -52,16 +64,24 @@ public void OnPluginEnd()
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");
g_iAutismBotIndex[client] = 0;
for(int i = 0; i < sizeof(g_sAutismBotAuthIDs); i++)
{
if(StrEqual(sAuthID, g_sAutismBotAuthIDs[i]))
{
g_iAutismBotIndex[client] = i + 1;
break;
}
}
g_bIsAutismBot[client] = g_iAutismBotIndex[client] != 0;
}
public void OnClientDisconnected(int client)
public void OnClientDisconnect(int client)
{
g_bIsAutismBot[client] = false;
g_iAutismBotIndex[client] = 0;
}
public bool Filter_AutismBot(const char[] sPattern, Handle hClients, int client)
@@ -90,10 +110,8 @@ public bool Filter_NonAutismBot(const char[] sPattern, Handle hClients, int clie
return true;
}
public int Native_IsAutismBot(Handle hPlugin, int numParams)
bool ValidateNativeClient(int client)
{
int client = GetNativeCell(1);
if(client > MaxClients || client <= 0)
{
ThrowNativeError(SP_ERROR_NATIVE, "Client is not valid.");
@@ -112,15 +130,29 @@ public int Native_IsAutismBot(Handle hPlugin, int numParams)
return false;
}
return true;
}
public int Native_IsAutismBot(Handle hPlugin, int numParams)
{
int client = GetNativeCell(1);
if(!ValidateNativeClient(client))
{
return false;
}
return g_bIsAutismBot[client];
}
/*
public Action ZR_OnClientMotherZombieEligible(int client)
public int Native_GetAutismBotIndex(Handle hPlugin, int numParams)
{
if (g_bIsAutismBot[client])
return Plugin_Handled;
int client = GetNativeCell(1);
return Plugin_Continue;
if(!ValidateNativeClient(client))
{
return 0;
}
return g_iAutismBotIndex[client];
}
*/