Can I make code for a function in two serverside lua files?

I was wondering if I could use GM:Initialize in my sv_rounds.lua and my init.lua. I need it to start some timers in sv_rounds and I need to set some variables in init.lua.

Create the GM:Initialize function in init.lua, then use hook.Add(“Initialize”, “SetupRoundTimers”, functiontorun) in sv_rounds.lua.

I don’t understand why you need two just place one in init.lua and call the functions and timers that are in sv_rounds.lua from it

For orginization’s sake. Also, can I hook a clientside function to Initialize?

Use hooks

[editline]22nd March 2011[/editline]

Having a second function would override it

Yeah, you could, since GM:Initialize() is a shared function.

(Edited for fix below)

Its shared, not really global.

Thanks, another question, could I use a variable from init.lua for my HUD in cl_init.lua?

No you need to network the value

Use UserMessages To Send Client To Server Info

or you can use networked variables, just dont use too many.

and GlobalInt() if it is global

Not just SetGlobalInt(), but there’s a hole slew of options:

Don’t even motivate him to use Networked Vars…