Title says most of it. In detail I’m looking for a nice damage script that finds the distance between the player shot and the shooting player. The closer the distance the more damage the weapon will do. (excluding melee weapons) Cheers in advance.
MAX_DISTANCE = 4096
local function EntityTakeDamage( ent, inf, atk, amt, info )
if ent:IsPlayer( ) then
if atk:IsPlayer( ) and info:IsDamageType( DMG_BULLET ) then
info:ScaleDamage( 1 - ( atk:GetShootPos( ):Distance( info:GetDamagePosition( ) ) / MAX_DISTANCE ) )
hook.Add( “EntityTakeDamage”, “DistanceScale.EntityTakeDamage”, EntityTakeDamage )
Something like that. Goes in autorun/server/distancedamage.lua.
Thanks a ton. I’ll check back with you if it works great.
So you’re fighting with the early version of middle-ages handcannons, eh?