Is there any way to call a function when the Server has done loading server.cfg so I can access my created convars on startup ?
In the hope of a quick answer,
Thanks by advance,
Yuri6037
Maybe create a command with command.Add and put that command last on server.cfg? Or just have a timer?
at the end of server.cfg
[QUOTE]lua_run theFunctionYouWantToRun()[/QUOTE]
So there is no way in pure lua ?
uhhhh
if you want to do it a dirty way
[code]timer.Simple(0, theFunctionYouWantToRun())[/code]
it won't run until a player connects (since the server is hibernating and time stops) but that's technically after server.cfg runs right?
Or just do it in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/Initialize]GM/Initialize[/url]
[QUOTE=meharryp;47890383]Or just do it in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/Initialize]GM/Initialize[/url][/QUOTE]
Pretty sure that runs long before server.cfg loads.
[QUOTE=TylerB;47889935]uhhhh
if you want to do it a dirty way
[code]timer.Simple(0, theFunctionYouWantToRun())[/code]
it won't run until a player connects (since the server is hibernating and time stops) but that's technically after server.cfg runs right?[/QUOTE]
Actualy a timer is a bad idea : I want it to be ran right after server.cfg is loaded, not when a player connects.
About GM/Initialize, well server.cfg gets loaded after so it won't work.
[QUOTE=Yuri6037;47891623]Actualy a timer is a bad idea : I want it to be ran right after server.cfg is loaded, not when a player connects.
About GM/Initialize, well server.cfg gets loaded after so it won't work.[/QUOTE]
Just explain why you need it and why it is so important to be ran right after. Maybe there are better methods for what you are trying to achieve.
there's a convar called "servercfgfile", set this convar before the cfg loads
ship your own fake .cfg file that will call exec server.cfg
then you can lua_run your own code in the cfg
Well for the moment I use a lua_run in the server.cfg.
And well I need to get the convar at load because my GameMode needs it before players joins. It's to set an auto reboot value in the system.
Sorry, you need to Log In to post a reply to this thread.