TOOL:RightClick

From GMod Wiki

Revision as of 09:32, 8 January 2010 by TomyLobo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NameRightClick
SyntaxTOOL:RightClick( TraceRes tr )
DescriptionCalled when the user right clicks.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=TOOL:RightClick]TOOL:RightClick [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionExtinguish the object in front of the player.
Used onNewerShared.png
Code
function TOOL:RightClick( tr )
 
	if (!tr.Entity) then return false end -- Is the trace (tr) an entity?
	if (!tr.Entity:IsValid() ) then return false end -- Is the entity an valid entity?
	if (tr.Entity:IsPlayer()) then return false end -- Is the entity a player?
	if (tr.Entity:IsWorld()) then return false end -- Is the entity an world entity?
 
	if ( CLIENT ) then return true end
 
	tr.Entity:Extinguish() -- Extinguish the entity
 
	return true
 
end
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox