• Some questions related to GAMEMODE.BaseClass and hooks.
    4 replies, posted
1. Does GAMEMODE.BaseClass include ALL the available gamemode hooks in GMod? 2. Are ALL the available gamemode hooks specified in the base gamemode? 3. How can I check if a string equals a valid gamemode hook name in gmod, if the above questions are false? I've been writing lua for 2 years now and this are one of the few things which I still don't understand. Thanks. [editline]02:44PM[/editline] By the way, please make sure that your answer to these questions are 100% correct or I might spend hours coding something which won't work fully after all.
Snip for stupidity.
1. GAMEMODE.BaseClass refers to the gamemode your gamemode is derived from. 2. Most likely. When you open the base gamemode files, you can see a bunch of empty functions. You'll have to go through the files and check with the wiki.
[QUOTE=NullPoint;18911013]For question 3: [lua]function IsValidHook( s ) return hook.GetTable()[s] != nil; end[/lua] [editline]01:49PM[/editline] I'm not 100% sure of this, so if anyone else could confirm, GAMEMODE.BaseClass does specify all available hooks.[/QUOTE] Wouldn't work for GM:PlayerSpawn() etc.
Yea, I wasn't thinking straight. That would only worked if the gamemode function had a hook, disregard that post.
Sorry, you need to Log In to post a reply to this thread.