TOOL:Reload

From GMod Wiki

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


Examples

DescriptionRemove the object in front of the player.
Used onNewerShared.png
Code
function TOOL:Reload( tr )
 
	if (!tr.Entity) then return false end
	if (!tr.Entity:IsValid() ) then return false end
	if (tr.Entity:IsPlayer()) then return false end
	if (tr.Entity:IsWorld()) then return false end
 
	if ( CLIENT ) then return true end
 
	tr.Entity:Remove()
 
	return true
 
end
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox