I know cl_init.lua and init.lua but im not sure what to put in shared.lua.... is it to share lua files or is it a global file for both init and cl_init to read off of?
It's for code that you want to run on the client and the server. Both the clientside and serverside files can read it if they use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/include]include[/url].
[QUOTE=MPan1;52424704]It's for code that you want to run on the client and the server. Both the clientside and serverside files can read it if they use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/include]include[/url].[/QUOTE]
So mainly you should put global vars and hook's in the shared alright gotcha
[QUOTE=0x02;52424720]So mainly you should put global vars and hook's in the shared alright gotcha[/QUOTE]
Not really, he didn't say that.
You put there anything that you want to be both on the client and the server (e.g. the StartCommand hook)
[QUOTE=0x02;52424720]So mainly you should put global vars and hook's in the shared alright gotcha[/QUOTE]
Not all hooks are shared though. Some are clientside or serverside only
[QUOTE=MPan1;52424779]Not all hooks are shared though. Some are clientside or serverside only[/QUOTE]
Technically you can make your hook.add code shared and it will never get called clientside if its not for cl or vise versa
[QUOTE=Kevlon;52424803]Technically you can make your hook.add code shared and it will never get called clientside if its not for cl or vise versa[/QUOTE]
Well, yes. But why?
Sorry, you need to Log In to post a reply to this thread.