Garry's Mod Wiki


You might be looking for the "Entity:Use" method, which has the same name as this hook.
  ENTITY:Use( Entity activator, Entity caller, number useType, number value )


Called when an entity "uses" this entity, for example a player pressing their +use key (default e) on this entity.

To change how often the hook is called, see Entity:SetUseType.

This hook only works for nextbot, ai and anim scripted entity types.


1 Entity activator
The entity that caused this input. This will usually be the player who pressed their use key.
2 Entity caller
The entity responsible for the input. This will typically be the same as activator unless some other entity is acting as a proxy
3 number useType
Use type, see USE enum.
4 number value
Any passed value.


Kills any player that uses this entity.

function ENT:Use( activator ) if ( activator:IsPlayer() ) then activator:Kill() end end