General > Developers Corner
[SOLVED] Chat Timer Error
Megiddo:
You need to invoke the chat library client side only.
Organik:
Megiddo,
I looked it the docs and such but can't find what I'm looking for. Is this as simple as adding another lua file with my timer code in it, and prefix that lua file with cl_ ?
EDIT: I looked through another addon I had, and they just added another folder inside modules called cl, and I created my timer in a file within that. Hopefully this works. However I've seem some addons that just prefix each file in a certain manner.. is this also acceptable?
Thanks,
Organik
JamminR:
Organik, there is no magic file name that makes a file or folder client side only.
We, and other mod writers, name our files in ways such as CL so we know those files include code, or are loaded in other files, as client side only.
Naming of files is often used in that manner for large projects, where huge blocks of code would be difficult to distinguish otherwise.
One quick way is to have something like "if SERVER then return" at the top of files (or functions) you want client side only.
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8e50.html gives a perfect example of if SERVER and if CLIENT.
(Yes, it's aimed at a first swep, but, the first bit of code block shows the server/client test.
Organik:
--- Quote from: JamminR on July 05, 2013, 08:05:50 PM ---Organik, there is no magic file name that makes a file or folder client side only.
We, and other mod writers, name our files in ways such as CL so we know those files include code, or are loaded in other files, as client side only.
Naming of files is often used in that manner for large projects, where huge blocks of code would be difficult to distinguish otherwise.
One quick way is to have something like "if SERVER then return" at the top of files (or functions) you want client side only.
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8e50.html gives a perfect example of if SERVER and if CLIENT.
(Yes, it's aimed at a first swep, but, the first bit of code block shows the server/client test.
--- End quote ---
That's very helpful. Thank you, JamminR.
Navigation
[0] Message Index
[*] Previous page
Go to full version