• Including lua files after Initialize
    6 replies, posted
Basicaly I want to check what gamemode is running before I run a specific amount of code. Is it ok If I do something like this?: [CODE] hook.Add("Initialize", "Example", function() include("gamemode1.lua") include("gamemode2.lua") end) [/CODE] This way the code seems to work pretty well, but I'm not sure If this is the best way to do it. What do you guys think about this? Thanks in Advance! :)
That's fine.
Just found out that I have a problem with TTT. TTT gamemode only Initializes after my includes inside the Initialize hook, why does that happen? Also, any solution without timers?
The hook you're looking for isn't Initialize, but [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PostGamemodeLoaded]GM:PostGamemodeLoaded[/url]
[QUOTE=JasonMan34;52471582]The hook you're looking for isn't Initialize, but [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PostGamemodeLoaded]GM:PostGamemodeLoaded[/url][/QUOTE] I was trying to find a PostInitialize x'D Thanks! EDIT: Actually that runs even faster than Initialize, way before the TTT gamemode... Any more ideias?
[QUOTE=Pwned231;52471587]Actually that runs even faster than Initialize, way before the TTT gamemode... Any more ideias?[/QUOTE] You're doing it wrong then What's your code?
[QUOTE=JasonMan34;52471601]You're doing it wrong then What's your code?[/QUOTE] Evrything is Done server side [CODE] hook.Add("PostGamemodeLoaded", "Example", function() include("gamemode1.lua") end) [/CODE] [CODE] print(gamemode_name) print(gamemode._name) [/CODE] prints nil. EDIT: Actualy if I use "engine.ActiveGamemode()" it works
Sorry, you need to Log In to post a reply to this thread.