[L4D2] Fix Tank HP is a lightweight SourceMod plugin for
Left 4 Dead 2 that ensures the Tank always spawns with the
correct health value defined by the z_tank_health ConVar.
This plugin fixes cases where the Tank may spawn with incorrect or outdated health by enforcing the ConVar value at spawn time, ensuring consistent and predictable behavior.
- Hooks into the
player_spawnevent to detect Tank spawns - Caches the
z_tank_healthConVar at plugin start - Automatically updates the cached value when the ConVar changes
- Applies correct current and maximum health to Tanks on spawn
- Caps health at 65535 to prevent integer overflow
- Validates client index and zombie class before applying changes
- Language: SourcePawn
- Dependencies:
- <sourcemod>
- <sdktools>
- Plugin file:
sm_tankhpfix.sp - Default cached health: 10000
- Core methods used:
- SetEntityHealth
- SetEntProp
- Compile
sm_tankhpfix.spusing the SourceMod compiler - Place the compiled
.smxfile into:addons/sourcemod/plugins/
- Restart the server or change the map to load the plugin
- Game: Left 4 Dead 2
- Server: Dedicated or Listen Server
- SourceMod: 1.10+ recommended
PabloSan @lexicon06
This project is released under the MIT License. You are free to use, modify, and redistribute it.