Skip to content

lexicon06/L4D2_FixTankHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

[L4D2] Fix Tank HP (z_tank_health Enforcement)

[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.


Features

  • Hooks into the player_spawn event to detect Tank spawns
  • Caches the z_tank_health ConVar 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

Technical Details

  • Language: SourcePawn
  • Dependencies:
    • <sourcemod>
    • <sdktools>
  • Plugin file: sm_tankhpfix.sp
  • Default cached health: 10000
  • Core methods used:
    • SetEntityHealth
    • SetEntProp

Installation

  1. Compile sm_tankhpfix.sp using the SourceMod compiler
  2. Place the compiled .smx file into:
    addons/sourcemod/plugins/
  3. Restart the server or change the map to load the plugin

Compatibility

  • Game: Left 4 Dead 2
  • Server: Dedicated or Listen Server
  • SourceMod: 1.10+ recommended

Author

PabloSan @lexicon06


License

This project is released under the MIT License. You are free to use, modify, and redistribute it.

About

Ensures the Tank in Left 4 Dead 2 spawns with the correct health by explicitly setting both current and maximum HP based on the z_tank_health ConVar.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors