Garry's Mod Wiki

Garry's Mod Wiki

  CTakeDamageInfo:SetDamageForce( Vector force )

Description

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.

Arguments

1 Vector force
The vector to set the force to.

Example

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 )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...