update betterwitchavoidance

This commit is contained in:
Jackzie 2020-10-05 15:50:01 -05:00
parent 13b1e424e2
commit 1673098d2c
No known key found for this signature in database
GPG key ID: 1E834FE36520537A

View file

@ -1,8 +1,6 @@
#pragma semicolon 1 #pragma semicolon 1
#pragma newdecls required #pragma newdecls required
#define DEBUG
#define PLUGIN_NAME "Better Witch Avoidance" #define PLUGIN_NAME "Better Witch Avoidance"
#define PLUGIN_DESCRIPTION "Makes bots avoid witches better" #define PLUGIN_DESCRIPTION "Makes bots avoid witches better"
#define PLUGIN_AUTHOR "jackzmc" #define PLUGIN_AUTHOR "jackzmc"
@ -13,7 +11,6 @@
#include <sdktools> #include <sdktools>
//#include <sdkhooks> //#include <sdkhooks>
#pragma newdecls required
public Plugin myinfo = public Plugin myinfo =
{ {
@ -56,8 +53,8 @@ public Action BotControlTimer(Handle timer)
//FindExistingWitch(); //FindExistingWitch();
return Plugin_Stop; return Plugin_Stop;
} }
if(HasEntProp(iWitchEntity,Prop_Send,"m_rage")) {
float witch_anger = GetEntPropFloat(iWitchEntity, Prop_Send, "m_rage", 0); float witch_anger = GetEntPropFloat(iWitchEntity, Prop_Send, "m_rage", 0);
ShowHintToAll("Witch (%d) Rage=%f", iWitchEntity, witch_anger);
if(FloatCompare(witch_anger,0.4) == 1) { if(FloatCompare(witch_anger,0.4) == 1) {
float WitchPosition[3]; float WitchPosition[3];
GetEntPropVector(iWitchEntity, Prop_Send, "m_vecOrigin", WitchPosition); GetEntPropVector(iWitchEntity, Prop_Send, "m_vecOrigin", WitchPosition);
@ -73,9 +70,25 @@ public Action BotControlTimer(Handle timer)
} }
} }
} }
}
return Plugin_Handled; return Plugin_Handled;
} }
public void FindExistingWitch() {
for (int i = MaxClients + 1; i < GetMaxEntities(); i++) {
if(IsValidEntity(i)) {
char name[16];
GetEntityClassname(i, name, sizeof(name));
if(StrContains(name,"Witch",true) > -1) {
PrintToServer("Found existing witch with id %d", i);
iWitchEntity = i;
CreateTimer(0.1, BotControlTimer, _, TIMER_REPEAT);
break;
}
}
}
}
//Credits to Timocop for the stock :D //Credits to Timocop for the stock :D
/** /**