diff --git a/addons/sourcemod/plugins/fixes/l4d2_spitter_acid_blocker.smx b/addons/sourcemod/plugins/fixes/l4d2_spitter_acid_blocker.smx new file mode 100644 index 000000000..0faae5e6f Binary files /dev/null and b/addons/sourcemod/plugins/fixes/l4d2_spitter_acid_blocker.smx differ diff --git a/addons/sourcemod/scripting/l4d2_spitter_acid_blocker.sp b/addons/sourcemod/scripting/l4d2_spitter_acid_blocker.sp new file mode 100644 index 000000000..60c84d68a --- /dev/null +++ b/addons/sourcemod/scripting/l4d2_spitter_acid_blocker.sp @@ -0,0 +1,39 @@ +#pragma semicolon 1 +#pragma newdecls required + +#include +#include + +#define L4D2_TEAM_INFECTED 3 + +public Plugin myinfo = +{ + name = "L4D2 - Spitter Acid Blocker", + author = "Altair Sossai", + description = "Prevents Spitter acid damage if the player controlling the Spitter enters spectator mode or switches teams before dying", + version = "1.0.0", + url = "https://github.com/SirPlease/L4D2-Competitive-Rework" +}; + +public void OnPluginStart() +{ + HookEvent("player_team", PlayerTeam_Event, EventHookMode_Post); +} + +void PlayerTeam_Event(Event event, const char[] name, bool dontBroadcast) +{ + int oldTeam = GetEventInt(event, "oldteam"); + if (oldTeam != L4D2_TEAM_INFECTED) + return; + + int client = GetClientOfUserId(GetEventInt(event, "userid")); + int entity = -1; + + while((entity = FindEntityByClassname(entity, "insect_swarm")) != INVALID_ENT_REFERENCE) + { + if(GetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity") != client) + continue; + + AcceptEntityInput(entity, "Kill"); + } +} \ No newline at end of file diff --git a/cfg/generalfixes.cfg b/cfg/generalfixes.cfg index 6cb1b9bfc..4ea9b49e0 100644 --- a/cfg/generalfixes.cfg +++ b/cfg/generalfixes.cfg @@ -69,6 +69,7 @@ sm plugins load fixes/l4d_fix_rotated_physblocker.smx sm plugins load fixes/firebulletsfix.smx sm plugins load fixes/l4d_fix_stagger_dir.smx sm plugins load fixes/l4d2_fix_rocket_pull.smx +sm plugins load fixes/l4d2_spitter_acid_blocker.smx // Anti-Cheat. sm plugins load anticheat/l4d2_noghostcheat.smx