Hello, I'm having this problem where only some add-ons I create will load and others will not.
In some instances, I encounter a problem where addon_name/lua/autorun is being ran, but addon_name/lua/cl_init.lua is not being ran (client-side and server-side error: (file not found) , regardless of there being content in cl_init.lua. Now, however, I am trying to create a simple add-on that adds a rank to the chat (e.g: (Superadmin) CafeMarsh: Hello!), but addon_name/lua/autorun is not even working this time.
If possible, I'd like to resolve both cl_init.lua not being found, but my main focus is on autorun not even loading.
File tree:
server/garrysmod/addons/chattags/
server/garrysmod/addons/chattags/lua/
server/garrysmod/addons/chattags/lua/cl_init.lua
server/garrysmod/addons/chattags/lua/init.lua
server/garrysmod/addons/chattags/lua/autorun
server/garrysmod/addons/chattags/lua/autorun/includes.lua
Code for /chattags/lua/autorun/includes.lua
if (SERVER) then
AddCSLuaFile( "cl_init.lua" )
include( "init.lua" )
end
if (CLIENT) then
include( "cl_init.lua" )
end
Code for /chattags/lua/cl_init.lua
print ( "{DEBUG}: Testing!" )
Code for chattags/lua/init.lua
print( "{DEBUG}: Testing (SERVERSIDE)!" )
Problem with the chattags addon: autorun not loading.
But your cl_init.lua and init.lua into a folder called chattags, so it'd look like this:
server/garrysmod/addons/chattags/lua/
server/garrysmod/addons/chattags/lua/chattags/cl_init.lua
server/garrysmod/addons/chattags/lua/chattags/init.lua
Then update your includes to this:
if (SERVER) then
AddCSLuaFile( "chattags/cl_init.lua" )
include( "chattags/init.lua" )
end
if (CLIENT) then
include( "chattags/cl_init.lua" )
end
Includes right now is looking for those files in the autorun folder, but can't find them, thus them not loading. (Atleast to my knowledge.)
Yeah, that seems to have fixed my problem. Thanks!
Sorry, you need to Log In to post a reply to this thread.