Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // download https://drive.google.com/open?id=0B0rPMDhb3gbhN3FLN2E0Q2ZjM1k
- #pragma semicolon 1
- /* Globals */
- #define DEBUG 1 /* Change this to 0 to disable debug info to be printed */
- #define DEBUG_TAG "SI Manipulation"
- #define DEBUG_PRINT_FORMAT "[%s] %s"
- #define PLUGIN_VERSION "1.0"
- #include <sourcemod>
- #include <sdktools>
- #include <l4d2_aidetours>
- static g_hunteraitype;
- static g_jockeyaitype;
- static g_chargeraitype;
- static g_spitteraitype;
- static g_smokeraitype;
- static g_boomeraitype;
- public Plugin:myinfo =
- {
- name = "[L4D2] L4D1 Special Infected AI restore & other SI AI improvements",
- author = "DeathChaos25",
- description = " ",
- version = PLUGIN_VERSION,
- url = " "
- };
- public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
- {
- decl String:s_GameFolder[32];
- GetGameFolderName(s_GameFolder, sizeof(s_GameFolder));
- if (!StrEqual(s_GameFolder, "left4dead2", false))
- {
- strcopy(error, err_max, "This plugin is for Left 4 Dead 2 Only!");
- return APLRes_Failure;
- }
- return APLRes_Success;
- }
- public OnPluginStart()
- {
- new Handle:HunterAIType = CreateConVar("hunter_ai_type", "1", "What Kind of AI do we enforce on the hunters (0 = default AI, 1 = L4D1 Hunter AI, 2 = Prioritize Incapped Survivors, 3 = Prioritize Survivor with lowest hp, 4 = Prioritize Survivor with higest hp)", FCVAR_PLUGIN, true, 0.0, true, 4.0);
- HookConVarChange(HunterAIType, ConVarHunterAIType);
- g_hunteraitype = GetConVarInt(HunterAIType);
- new Handle:JockeyAIType = CreateConVar("jockey_ai_type", "1", "What Kind of AI do we enforce on the jockeys (0 = default AI, 1 = Prioritize Survivor with lowest hp, 2 = Prioritize Survivor with higest hp)", FCVAR_PLUGIN, true, 0.0, true, 2.0);
- HookConVarChange(JockeyAIType, ConVarJockeyAIType);
- g_jockeyaitype = GetConVarInt(JockeyAIType);
- new Handle:ChargerAIType = CreateConVar("charger_ai_type", "1", "What Kind of AI do we enforce on the chargers (0 = default AI, 1 = Prioritize Survivor with lowest hp, 2 = Prioritize Survivor with higest hp)", FCVAR_PLUGIN, true, 0.0, true, 2.0);
- HookConVarChange(ChargerAIType, ConVarChargerAIType);
- g_chargeraitype = GetConVarInt(ChargerAIType);
- new Handle:BoomerAIType = CreateConVar("boomer_ai_type", "1", "What Kind of AI do we enforce on the boomers (0 = default AI, 1 = Prioritize Survivor with lowest hp, 2 = Prioritize Survivor with higest hp)", FCVAR_PLUGIN, true, 0.0, true, 2.0);
- HookConVarChange(BoomerAIType, ConVarBoomerAIType);
- g_boomeraitype = GetConVarInt(BoomerAIType);
- new Handle:SpitterAIType = CreateConVar("spitter_ai_type", "1", "What Kind of AI do we enforce on the spitters (0 = default AI, 1 = Prioritize Survivor with lowest hp, 2 = Prioritize Survivor with higest hp)", FCVAR_PLUGIN, true, 0.0, true, 2.0);
- HookConVarChange(SpitterAIType, ConVarSpitterAIType);
- g_spitteraitype = GetConVarInt(SpitterAIType);
- new Handle:SmokerAIType = CreateConVar("smoker_ai_type", "1", "What Kind of AI do we enforce on the smokers (0 = default AI, 1 = Prioritize Survivor with lowest hp, 2 = Prioritize Survivor with higest hp)", FCVAR_PLUGIN, true, 0.0, true, 2.0);
- HookConVarChange(SmokerAIType, ConVarSmokerAIType);
- g_smokeraitype = GetConVarInt(SmokerAIType);
- AutoExecConfig(true, "l4d2_si_ai_manipulation");
- }
- // Tank AI Manipulation
- // Here, we force the Tank to prioritize incapped survivors
- public Action:L4D2_OnTankAttackUpdate(tank, &victim)
- {
- if (IsInfected(tank) && IsTank(tank) && IsPlayerAlive(tank)) //Is this a valid tank?
- {
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(tank, target, 150.0))
- {
- #if DEBUG
- Debug_PrintText("Tank (%i, %N) has changed targets to Survivor %N! (id:%i)", tank, tank, target, target);
- #endif
- // he is now the Tank's target
- victim = GetEntData(target, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- }
- }
- return Plugin_Continue;
- }
- // Hunter AI Manipulation
- public Action:L4D2_OnHunterAttackUpdate(hunter, &victim)
- {
- if (IsInfected(hunter) && IsPlayerAlive(hunter))
- {
- new nearestclient, Float:lastdistance = 1000000.0;
- if (g_hunteraitype == 1) //1 = L4D1 Hunter AI
- {
- for (new client = 1; client <= MaxClients; client++)
- {
- new Float:Origin[3], Float:TOrigin[3];
- if (IsSurvivor(client) && IsPlayerAlive(client) && !IsPlayerHeld(client))
- {
- GetEntPropVector(client, Prop_Send, "m_vecOrigin", Origin);
- GetEntPropVector(hunter, Prop_Send, "m_vecOrigin", TOrigin);
- new Float:distance = GetVectorDistance(TOrigin, Origin);
- if (lastdistance > distance)
- {
- lastdistance = distance;
- nearestclient = client;
- }
- }
- }
- if (IsSurvivor(nearestclient))
- {
- #if DEBUG
- Debug_PrintText("Hunter (%i, %N) has changed targets to Survivor %N! (id:%i)", hunter, hunter, nearestclient, nearestclient);
- #endif
- victim = GetEntData(nearestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- }
- else if (g_hunteraitype == 2) //2 = Prioritize Incapped Survivors
- {
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(hunter, target, 400.0))
- {
- #if DEBUG
- Debug_PrintText("Hunter (%i, %N) has changed targets to Survivor %N! (id:%i)", hunter, hunter, target, target);
- #endif
- // he is now the Hunter's target
- victim = GetEntData(target, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- }
- }
- else if (g_hunteraitype == 3) //3 = Prioritize Survivor with lowest hp (EXCLUDING INCAPS)
- {
- new weakestclient, leasthp = 100, mostincaps = 0;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(hunter, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") >= mostincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) <= leasthp)
- {
- mostincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- leasthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- weakestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("Hunter (%i, %N) has changed targets to Survivor %N! (id:%i)", hunter, hunter, weakestclient, weakestclient);
- #endif
- // he is now the Hunter's target
- victim = GetEntData(weakestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- else if (g_hunteraitype == 4) //4 = Prioritize Survivor with higest hp (EXCLUDING INCAPS)
- {
- new healthiestclient, mosthp = 0, leastincaps = 5;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(hunter, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") <= leastincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) >= mosthp)
- {
- leastincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- mosthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- healthiestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("Hunter (%i, %N) has changed targets to Survivor %N! (id:%i)", hunter, hunter, healthiestclient, healthiestclient);
- #endif
- // he is now the Hunter's target
- victim = GetEntData(healthiestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- }
- return Plugin_Continue;
- }
- public Action:L4D2_OnJockeyAttackUpdate(jockey, &victim)
- {
- if (g_jockeyaitype == 1) //1 = Prioritize Survivor with lowest hp (EXCLUDING INCAPS)
- {
- new weakestclient, leasthp = 100, mostincaps = 0;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(jockey, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") >= mostincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) <= leasthp)
- {
- mostincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- leasthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- weakestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("Jockey (%i, %N) has changed targets to Survivor %N! (id:%i)", jockey, jockey, weakestclient, weakestclient);
- #endif
- // he is now the Jockey's target
- victim = GetEntData(weakestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- else if (g_jockeyaitype == 2) //2 = Prioritize Survivor with higest hp (EXCLUDING INCAPS)
- {
- new healthiestclient, mosthp = 0, leastincaps = 5;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(jockey, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") <= leastincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) >= mosthp)
- {
- leastincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- mosthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- healthiestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("Jockey (%i, %N) has changed targets to Survivor %N! (id:%i)", jockey, jockey, healthiestclient, healthiestclient);
- #endif
- // he is now the Jockey's target
- victim = GetEntData(healthiestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- public Action:L4D2_OnChargerAttackUpdate(charger, &victim)
- {
- if (g_chargeraitype == 1) //1 = Prioritize Survivor with lowest hp (EXCLUDING INCAPS)
- {
- new weakestclient, leasthp = 100, mostincaps = 0;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(charger, target, 600.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") >= mostincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) <= leasthp)
- {
- mostincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- leasthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- weakestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("Charger (%i, %N) has changed targets to Survivor %N! (id:%i)", charger, charger, weakestclient, weakestclient);
- #endif
- // he is now the Charger's target
- victim = GetEntData(weakestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- else if (g_chargeraitype == 2) //2 = Prioritize Survivor with higest hp (EXCLUDING INCAPS)
- {
- new healthiestclient, mosthp = 0, leastincaps = 5;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(charger, target, 600.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") <= leastincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) >= mosthp)
- {
- leastincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- mosthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- healthiestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("Charger (%i, %N) has changed targets to Survivor %N! (id:%i)", charger, charger, healthiestclient, healthiestclient);
- #endif
- // he is now the Charger's target
- victim = GetEntData(healthiestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- public Action:L4D2_OnSpitterAttackUpdate(spitter, &victim)
- {
- if (g_spitteraitype == 1) //1 = Prioritize Survivor with lowest hp (EXCLUDING INCAPS)
- {
- new weakestclient, leasthp = 100, mostincaps = 0;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(spitter, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") >= mostincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) <= leasthp)
- {
- mostincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- leasthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- weakestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("spitter (%i, %N) has changed targets to Survivor %N! (id:%i)", spitter, spitter, weakestclient, weakestclient);
- #endif
- // he is now the spitter's target
- victim = GetEntData(weakestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- else if (g_spitteraitype == 2) //2 = Prioritize Survivor with higest hp (EXCLUDING INCAPS)
- {
- new healthiestclient, mosthp = 0, leastincaps = 5;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(spitter, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") <= leastincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) >= mosthp)
- {
- leastincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- mosthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- healthiestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("spitter (%i, %N) has changed targets to Survivor %N! (id:%i)", spitter, spitter, healthiestclient, healthiestclient);
- #endif
- // he is now the spitter's target
- victim = GetEntData(healthiestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- public Action:L4D2_OnSmokerAttackUpdate(smoker, &victim)
- {
- if (g_smokeraitype == 1) //1 = Prioritize Survivor with lowest hp (EXCLUDING INCAPS)
- {
- new weakestclient, leasthp = 100, mostincaps = 0;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(smoker, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") >= mostincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) <= leasthp)
- {
- mostincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- leasthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- weakestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("smoker (%i, %N) has changed targets to Survivor %N! (id:%i)", smoker, smoker, weakestclient, weakestclient);
- #endif
- // he is now the smoker's target
- victim = GetEntData(weakestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- else if (g_smokeraitype == 2) //2 = Prioritize Survivor with higest hp (EXCLUDING INCAPS)
- {
- new healthiestclient, mosthp = 0, leastincaps = 5;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(smoker, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") <= leastincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) >= mosthp)
- {
- leastincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- mosthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- healthiestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("smoker (%i, %N) has changed targets to Survivor %N! (id:%i)", smoker, smoker, healthiestclient, healthiestclient);
- #endif
- // he is now the smoker's target
- victim = GetEntData(healthiestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- public Action:L4D2_OnBoomerAttackUpdate(boomer, &victim)
- {
- if (g_boomeraitype == 1) //1 = Prioritize Survivor with lowest hp (EXCLUDING INCAPS)
- {
- new weakestclient, leasthp = 100, mostincaps = 0;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(boomer, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") >= mostincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) <= leasthp)
- {
- mostincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- leasthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- weakestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("boomer (%i, %N) has changed targets to Survivor %N! (id:%i)", boomer, boomer, weakestclient, weakestclient);
- #endif
- // he is now the boomer's target
- victim = GetEntData(weakestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- else if (g_boomeraitype == 2) //2 = Prioritize Survivor with higest hp (EXCLUDING INCAPS)
- {
- new healthiestclient, mosthp = 0, leastincaps = 5;
- for (new target = 1; target <= MaxClients; target++)
- {
- // Is our new target alive? not incapped? not pinned by another si? not too far away?
- if (IsSurvivor(target) && IsPlayerAlive(target) && !IsIncaped(target) && !IsPlayerHeld(target) && IsNotFarFromTarget(boomer, target, 400.0))
- {
- if (GetEntProp(target, Prop_Send, "m_currentReviveCount") <= leastincaps)
- {
- if (GetClientHealth(target) + GetPlayerTempHealth(target) >= mosthp)
- {
- leastincaps = GetEntProp(target, Prop_Send, "m_currentReviveCount");
- mosthp = GetClientHealth(target) + GetPlayerTempHealth(target);
- healthiestclient = target;
- }
- }
- }
- }
- #if DEBUG
- Debug_PrintText("boomer (%i, %N) has changed targets to Survivor %N! (id:%i)", boomer, boomer, healthiestclient, healthiestclient);
- #endif
- // he is now the boomer's target
- victim = GetEntData(healthiestclient, L4D2_RefEntityHandle());
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- stock bool:IsTank(client)
- {
- return GetEntProp(client, Prop_Send, "m_zombieClass") == 8;
- }
- stock bool:IsSurvivor(client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && (GetClientTeam(client) == 2 || GetClientTeam(client) == 4);
- }
- stock bool:IsInfected(client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 3;
- }
- stock bool:IsIncaped(client)
- {
- return bool:GetEntProp(client, Prop_Send, "m_isIncapacitated", 1);
- }
- stock bool:IsPlayerHeld(client)
- {
- new jockey = GetEntPropEnt(client, Prop_Send, "m_jockeyAttacker");
- new charger = GetEntPropEnt(client, Prop_Send, "m_pummelAttacker");
- new hunter = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker");
- new smoker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner");
- if (jockey > 0 || charger > 0 || hunter > 0 || smoker > 0)
- {
- return true;
- }
- return false;
- }
- stock bool:IsNotFarFromTarget(client, target, Float:targetdistance)
- {
- new Float:Origin[3], Float:TOrigin[3];
- GetEntPropVector(client, Prop_Send, "m_vecOrigin", Origin);
- GetEntPropVector(target, Prop_Send, "m_vecOrigin", TOrigin);
- new Float:distance = GetVectorDistance(TOrigin, Origin);
- if (distance <= targetdistance)
- {
- return true;
- }
- return false;
- }
- // temp health stock bool shamelessly taken from l4d_stocks
- stock GetPlayerTempHealth(client)
- {
- static Handle:painPillsDecayCvar = INVALID_HANDLE;
- if (painPillsDecayCvar == INVALID_HANDLE)
- {
- painPillsDecayCvar = FindConVar("pain_pills_decay_rate");
- if (painPillsDecayCvar == INVALID_HANDLE)
- {
- return -1;
- }
- }
- new tempHealth = RoundToCeil(GetEntPropFloat(client, Prop_Send, "m_healthBuffer") - ((GetGameTime() - GetEntPropFloat(client, Prop_Send, "m_healthBufferTime")) * GetConVarFloat(painPillsDecayCvar))) - 1;
- return tempHealth < 0 ? 0 : tempHealth;
- }
- public ConVarHunterAIType(Handle:convar, const String:oldValue[], const String:newValue[])
- {
- g_hunteraitype = GetConVarInt(convar);
- }
- public ConVarJockeyAIType(Handle:convar, const String:oldValue[], const String:newValue[])
- {
- g_jockeyaitype = GetConVarInt(convar);
- }
- public ConVarChargerAIType(Handle:convar, const String:oldValue[], const String:newValue[])
- {
- g_chargeraitype = GetConVarInt(convar);
- }
- public ConVarSmokerAIType(Handle:convar, const String:oldValue[], const String:newValue[])
- {
- g_smokeraitype = GetConVarInt(convar);
- }
- public ConVarSpitterAIType(Handle:convar, const String:oldValue[], const String:newValue[])
- {
- g_spitteraitype = GetConVarInt(convar);
- }
- public ConVarBoomerAIType(Handle:convar, const String:oldValue[], const String:newValue[])
- {
- g_boomeraitype = GetConVarInt(convar);
- }
- #if DEBUG
- stock Debug_PrintText(const String:format[], any:...)
- {
- decl String:buffer[256];
- VFormat(buffer, sizeof(buffer), format, 2);
- LogMessage(buffer);
- new AdminId:adminId;
- for (new client = 1; client <= MaxClients; client++)
- {
- if (!IsClientInGame(client) || IsFakeClient(client))
- {
- continue;
- }
- adminId = GetUserAdmin(client);
- if (adminId == INVALID_ADMIN_ID || !GetAdminFlag(adminId, Admin_Root))
- {
- continue;
- }
- PrintToChat(client, DEBUG_PRINT_FORMAT, DEBUG_TAG, buffer);
- }
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment