G.DropEntityIfHeld

From GMod Wiki

Revision as of 19:18, 6 October 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax DropEntityIfHeld( Entity HeldEntity )
Where is this used?
Description:
Causes a player to drop an entity being held with a Gravity Gun.
Returns: nil
Part of Library: Global Functions
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.DropEntityIfHeld]G.DropEntityIfHeld [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDetermine whether or not a player is allowed to 'punt' an entity with the Gravity gun and drop the entity if not.
Used onNewerServer.png
Code
function gravgunPunt( userid, target )
	if userid:IsAdmin() then
		return true // Only let admins punt items.
	else
		if SERVER then
			 DropEntityIfHeld( target ) end // Drop the entity
		end
		return false // Don't let the minge's punt items at people!
	end
end
 
hook.Add( "GravGunPunt", "gravgunPunt", gravgunPunt )
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox