hook.Call

From GMod Wiki

Revision as of 16:20, 5 November 2011 by Disseminate (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Warning 64 light.png Internal Function: hook.Call
hook.Call is an internal function. This means you will be able to call it, but you really shouldn't.


Function
Syntax hook.Call( String name, Table gm[, ...] )
Where is this used?
Description:
Called by the engine to call a hook added by hook.Add and a gamemode hook on GAMEMODE:TheHookName
Returns: nil
Part of Library: Hook
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Hook.Call]Hook.Call [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionCalls the hook "PlayerCanPickupWeapon" to detirm
Used onNewerClient.png
Code
function ENT:Use(activator,caller)
	if not self.weaponclass:IsValid() then return false end
 
	local CanPickup = hook.Call("PlayerCanPickupWeapon", GAMEMODE, activator, weapon)
	if not CanPickup then weapon:Remove() return end
 
	local weapon = ents.Create(class)
	weapon:SetAngles(self:GetAngles())
	weapon:SetPos(self:GetPos())
	weapon.ShareGravgun = true
	weapon.nodupe = true
	weapon.ammohacked = ammohax
	weapon:Spawn()
	self:Remove()
end
OutputRemoves the weapon if the hook returns false


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox