• Gamemode hooks
    4 replies, posted
I saw a lot of hooks are in the table named GM, such as [lua] GM:OnEntityCreated() GM:OnPlayerHitGround(Player) [/lua] However, when I try to use them in lua code, putting them in autorun/server, or autorun/client folder, the error "Try to index Global 'GM' (a nil value)" keeps pop up. How can I use the hooks on this table? Thanks!
If its in autorun try using [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexd8ca.html]hook.Add[/url][/b]
Gamemode hooks can only be used in gamemodes, that is why GM returns a nil value. If you wanna hook something in your code that's outside a gamemode, use hook.Add (as stated above).
I see that. It is cool. Thank you guys.
If you're trying to access something from the gamemode, you can also use GAMEMODE outside of the gamemode.
Sorry, you need to Log In to post a reply to this thread.