Gamemode.OnPhysgunReload

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameOnPhysgunReload
SyntaxGM:OnPhysgunReload( Entity Weapon, Player Player )
DescriptionDetermines whether a player can use the Physgun reload function (UnFreeze).
ReturnsBoolean Allow reload
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.OnPhysgunReload]Gamemode.OnPhysgunReload [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionPrevents non-admins from unfreezing physics props.
Used onNewerServer.png
Code
function UnFreezePhysProp(_, ply)
	//Get the entity the player is looking at
	local ent = ply:GetEyeTrace().Entity
 
	//If the entity is valid and is a physics prop
	if ent and ValidEntity(ent) and ent:GetClass() == "prop_physics" then
		if not ply:IsAdmin() then return false end -- Disallow unfreeze for non-admins
	end
end
hook.Add("OnPhysgunReload", "StopUnFreezePhysProp", UnFreezePhysProp)
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox