Garry's Mod Wiki

Player:TraceHullAttack

  Entity Player:TraceHullAttack( Vector startPos, Vector endPos, Vector mins, Vector maxs, number damage, number damageFlags, number damageForce, boolean damageAllNPCs )

Description

Performs a trace hull and applies damage to the entities hit, returns the first entity hit.

Hitting the victim entity with this function in ENTITY:OnTakeDamage can cause infinite loops.

Arguments

1 Vector startPos
The start position of the hull trace.
2 Vector endPos
The end position of the hull trace.
3 Vector mins
The minimum coordinates of the hull.
4 Vector maxs
The maximum coordinates of the hull.
5 number damage
The damage to be applied.
6 number damageFlags
Bitflag specifying the damage type, see DMG enum.
7 number damageForce
The force to be applied to the hit object.
8 boolean damageAllNPCs
Whether to apply damage to all hit NPCs or not.

Returns

1 Entity
The hit entity