GohoCraft

Gmod13 - Simple damage scaling

May 4th, 2014
190
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*#################################################
  2. ###     Simple damage scaling
  3. #################################################*/
  4.  
  5. hook.Add("EntityTakeDamage", "ScalePlayerDamage", function( target, dmginfo )
  6.     if target:IsPlayer() then                       -- Target is player?
  7.         local bullet_scale      = 0.5               -- Bullets do half damage
  8.         local explosion_scale   = 0.25              -- Explosions do 1/4 damage
  9.         if dmginfo:IsBulletDamage() then
  10.             dmginfo:ScaleDamage( bullet_scale )
  11.     end
  12.         if dmginfo:IsExplosionDamage() then
  13.             dmginfo:ScaleDamage( explosion_scale )
  14.         end
  15.     end
  16. end)
RAW Paste Data