Gamemode.GravGunPunt

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameGravGunPunt
SyntaxGM:GravGunPunt( Player ply, Entity ent )
DescriptionDetermine whether or not you want to allow users to 'punt' items with the Gravity gun.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.GravGunPunt]Gamemode.GravGunPunt [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.
Used onNewerShared.png
Code
 
function gravgunPunt( userid, target )
	if userid:IsAdmin() then
		return true // Only let admins punt items.
	else
		if SERVER then DropEntityIfHeld( target ) end
		return false // Don't let the minge's punt items at people!
	end
end
 
hook.Add( "GravGunPunt", "gravgunPunt", gravgunPunt )
OutputN/A


Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox