Garry's Mod Wiki


  CTakeDamageInfo:SetDamageForce( Vector force )


Sets the directional force of the damage.

This function seems to have no effect on player knockback. To disable knockback entirely, see EFL_NO_DAMAGE_FORCES or use workaround example below.


1 Vector force
The vector to set the force to.


Workaround for player knockback quenching.

local ent = Entity(1) local oldvel = ent:GetVelocity() -- Damage taking example local dmgi = DamageInfo() dmgi:SetDamageType( DMG_RADIATION ) dmgi:SetDamage( 5 ) dmgi:SetAttacker( Entity(0) ) dmgi:SetInflictor( Entity(0) ) ent:TakeDamageInfo( dmgi ) local newvel = ent:GetVelocity() ent:SetVelocity( oldvel - newvel )