Garry's Mod Wiki

ENTITY:Use

ENTITY:Use( Entity activator, Entity caller, number useType, number value )

Description

Called when another entity uses this entity, example would be a player pressing "+use" this entity.

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

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

Arguments

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 Enums/USE.
4 number value
Any passed value.

Example

Kills any player that uses this entity.

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

Page Links


Special Pages


Wikis

?

Render Time: 20ms

Session 0
DB GetPage 3
Generate Html 1
Render Body 0
Render Sidebar 4