• The good way to call a 'hook'.
    3 replies, posted
I am making a gamemode and I wan toptimize it. I saw some method to call hooks well but I don't remember them. What I want to do is something like this: [lua] function GM:PlayerSpawn( ply ) self.BaseClass:PlayerLoadout( ply ); -- It's the hook end [/lua] I'm not sure that's the good way :S. EDIT: Also, what's the first hook called when a player join?
The first hook called is [URL="http://wiki.garrysmod.com/?title=Gamemode.PlayerConnect"]PlayerConnect[/URL]. And if you want to call a hook use this : [lua]local Call = hook.Call("LOLHOOK",GAMEMODE,..)[/lua] Where .. is replace with the arguments for the hook.
gamemode.Call( "HookName", ... ) Where ... are any arguments you want. This is functionally the same as what Kialtia posted, just nicer to use in my opinion.
Ok, thank you guys :D.
Sorry, you need to Log In to post a reply to this thread.