On the Garry's Mod wiki, there are 2 hooks that have the same names, but are in different categories. These hooks are [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PreDrawViewModel]GM:PreDrawViewModel[/url], and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/PreDrawViewModel]SWEP:PreDrawViewModel[/url]. When using hook.Add, how would lua distinguish between these two?
Sorry if this is a dumb question, but I'm a bit new at lua, so thank you if anyone can help!
One is a hook for the hook.Add function.
The other is to add it on a Swep as a function and only works when you've got the weapon equiped.
Next time take a look as well to the categories.
And when creating the hook, dont put the GM: behind or anything like that telling the category.
SWEP:PreDrawViewModel is used in a SWEP's lua script, PreDrawViewModel is the only one of those two used by hook.Add()
OK thanks for the answers! Also, I know how to use hop.Add, but how do I use function hooks, like the ones found in SWeps?
[QUOTE=Dan41550;50430711]OK thanks for the answers! Also, I know how to use hop.Add, but how do I use function hooks, like the ones found in SWeps?[/QUOTE]
You'll only need to use them when creating sweps wich would be:
[CODE]
function SWEP:PreDrawViewModel()
end
[/CODE]
Sorry, you need to Log In to post a reply to this thread.