ENTITY/Use

From Garry's Mod
Jump to: navigation, search
 ENTITY:Use( )

Contents

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.

Arguments

Entity activator

The initial cause for the input getting triggered. This can be different from the caller in some cases.

Arguments

Entity caller

The entity originally responsible for the input. Typically you should use this if you're checking for which player pressed +use.

Arguments

number useType

Use type, see USE_ Enums.

Arguments

number value

Any passed value.

Examples

Example

Kills any player that uses this entity.

function ENT:Use( activator, caller )
	if IsValid(caller) and caller:IsPlayer() then 
		caller:Kill()
	end
end
Personal tools
Navigation