Currently in the works of creating a addon and I’m having some trouble but I think I know the problem. I just have a questions to fix my problem. Do file prefixes matter? Such as cl_, sh_, sv_, etc?
Not as long as you use the right things, like AddCSLuaFile() and include(). The default files should be shared.lua cl_init.lua and init.lua(or sv_init.lua) though.
You should try to use those prefixes if those files use a shared environment (all in the same folder) for realm differentiation. They’re not required, but they look cleaner.
What’s the difference between AddCSLuaFile and include?
include executes the lua script (server and clientside) while AddCSLuaFile sends the file to clients and adds it to their cache – include all files, AddCSLuaFile shared and clientside files only.
Ah alright, thank you very much.
[editline]5th May 2015[/editline]
Well uh, for future reference. I’ve noticed that you cant have custom file types in entities. Specifically SNPC. You have to use default file types as stated by collincraig.
You can manually / automatically add npcs / weapons / etc… to their respective table so that you don’t need to use those folders…
If you want to use those folders though, you can use, for example, gamemodes/gmname/entities/entities/blah.lua instead of blah/ with init.lua, shared.lua and cl_init.lua
If you only create a Lua file in place of a folder then that file will be shared… Another note, you can create a shared.lua file and have it include file-names you want ( I did that for my swep base )
Ah ok, thanks