TOOL:Think

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameThink
SyntaxTOOL:Think( )
DescriptionCalled every frame while the tool is being used.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=TOOL:Think]TOOL:Think [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionIgnite everything the player looks at for 1 minute.
Used onNewerShared.png
Code
function TOOL:Think( )
 
	local trace = self:GetOwner():GetEyeTrace()
	if (!trace.Entity) then return end
	if (!trace.Entity:IsValid() ) then return end
	if (trace.Entity:IsPlayer()) then return end
	if (trace.Entity:IsWorld()) then return end
 
 
	trace.Entity:Extinguish()
	trace.Entity:Ignite( 60, 0 )
 
end
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox