mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-09 07:23:21 +00:00
update betterwitchavoidance
This commit is contained in:
parent
13b1e424e2
commit
1673098d2c
1 changed files with 29 additions and 16 deletions
|
@ -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,19 +53,20 @@ public Action BotControlTimer(Handle timer)
|
||||||
//FindExistingWitch();
|
//FindExistingWitch();
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
float witch_anger = GetEntPropFloat(iWitchEntity, Prop_Send, "m_rage", 0);
|
if(HasEntProp(iWitchEntity,Prop_Send,"m_rage")) {
|
||||||
ShowHintToAll("Witch (%d) Rage=%f", iWitchEntity, witch_anger);
|
float witch_anger = GetEntPropFloat(iWitchEntity, Prop_Send, "m_rage", 0);
|
||||||
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);
|
||||||
for (int i = 1; i < MaxClients; i++) {
|
for (int i = 1; i < MaxClients; i++) {
|
||||||
if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2 && IsFakeClient(i)) {
|
if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2 && IsFakeClient(i)) {
|
||||||
float BotPosition[3];
|
float BotPosition[3];
|
||||||
GetClientAbsOrigin(i, BotPosition);
|
GetClientAbsOrigin(i, BotPosition);
|
||||||
|
|
||||||
float distance = GetVectorDistance(BotPosition, WitchPosition);
|
float distance = GetVectorDistance(BotPosition, WitchPosition);
|
||||||
if(distance <= 120 || (FloatCompare(witch_anger,0.6) == 1 && distance <= 220)) {
|
if(distance <= 120 || (FloatCompare(witch_anger,0.6) == 1 && distance <= 220)) {
|
||||||
L4D2_RunScript("CommandABot({cmd=2,bot=GetPlayerFromUserID(%i),target=EntIndexToHScript(%d)})", GetClientUserId(i), iWitchEntity);
|
L4D2_RunScript("CommandABot({cmd=2,bot=GetPlayerFromUserID(%i),target=EntIndexToHScript(%d)})", GetClientUserId(i), iWitchEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +74,21 @@ 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
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue