Addons downloading upon joining the server

Hi,

recently I updated my DarkRP to 2.5.1 and it seems to be working fine. But many models and guns are errors for my friends. I have the workshop items added in the init.lua just like in DarkRP 2.4.3, and it says that it is loading addons upon joining, but many things are errors for them.

For example, I have my init.lua setup like this


GM.Version = "2.5.1"
GM.Name = "DarkRP"
GM.Author = "By Rickster, Updated: Pcwizdan, Sibre, philxyz, [GNC] Matt, Chrome Bolt, FPtje Falco, Eusion, Drakehawke"


DeriveGamemode("sandbox")

AddCSLuaFile("libraries/interfaceloader.lua")
AddCSLuaFile("libraries/modificationloader.lua")
AddCSLuaFile("libraries/disjointset.lua")
AddCSLuaFile("libraries/fn.lua")

AddCSLuaFile("config/config.lua")
AddCSLuaFile("config/addentities.lua")
AddCSLuaFile("config/jobrelated.lua")
AddCSLuaFile("config/ammotypes.lua")

AddCSLuaFile("cl_init.lua")

GM.Config = GM.Config or {}
GM.NoLicense = GM.NoLicense or {}

include("libraries/interfaceloader.lua")

include("config/_MySQL.lua")
include("config/config.lua")
include("config/licenseweapons.lua")

include("libraries/modificationloader.lua")
include("libraries/fn.lua")
include("libraries/database.lua")
include("libraries/disjointset.lua")

resource.AddWorkshop( "111853609" )

resource.AddWorkshop( "173953834" )

resource.AddWorkshop( "182770032" )

resource.AddWorkshop( "184025769" )

resource.AddWorkshop( "183313434" )

resource.AddWorkshop( "113495466" )

resource.AddWorkshop( "149491742" )

resource.AddWorkshop( "151479233" )

resource.AddWorkshop( "123581457" )

resource.AddWorkshop( "155688712" )

resource.AddWorkshop( "104548572" )

resource.AddWorkshop( "185609021" )

resource.AddWorkshop( "187257499" )

resource.AddWorkshop( "150455514" )

resource.AddWorkshop( "104483020" )

resource.AddWorkshop( "104492363" )

resource.AddWorkshop( "148628139" )

resource.AddWorkshop( "177136567" )

resource.AddWorkshop( "110571239" )

resource.AddWorkshop( "106516163" )

resource.AddWorkshop( "187821807" )

resource.AddWorkshop( "125628460" )

resource.AddWorkshop( "163221745" )

resource.AddWorkshop( "115164078" )

/*---------------------------------------------------------------------------
Loading modules
---------------------------------------------------------------------------*/
local fol = GM.FolderName.."/gamemode/modules/"
local files, folders = file.Find(fol .. "*", "LUA")
for k,v in pairs(files) do
	if DarkRP.disabledDefaults["modules"][k] then continue end

	include(fol .. v)
end

for _, folder in SortedPairs(folders, true) do
	if folder == "." or folder == ".." or DarkRP.disabledDefaults["modules"][folder] then continue end

	for _, File in SortedPairs(file.Find(fol .. folder .."/sh_*.lua", "LUA"), true) do
		AddCSLuaFile(fol..folder .. "/" ..File)

		if File == "sh_interface.lua" then continue end
		include(fol.. folder .. "/" ..File)
	end

	for _, File in SortedPairs(file.Find(fol .. folder .."/sv_*.lua", "LUA"), true) do
		if File == "sv_interface.lua" then continue end
		include(fol.. folder .. "/" ..File)
	end

	for _, File in SortedPairs(file.Find(fol .. folder .."/cl_*.lua", "LUA"), true) do
		if File == "cl_interface.lua" then continue end
		AddCSLuaFile(fol.. folder .. "/" ..File)
	end
end

MySQLite.initialize()

DarkRP.DARKRP_LOADING = true
include("config/jobrelated.lua")
include("config/addentities.lua")
include("config/ammotypes.lua")
DarkRP.DARKRP_LOADING = nil

DarkRP.finish()


But many m9k weapons and player models are errors. Is it supposed to be setup differently? Please help

I would make a resource.lua file in /root/lua/autorun/server

Then place this code, and your scripts as usual:


if (SERVER) then
	resource.AddWorkshop( "143906751" ) -- TTT
	resource.AddFile("maps/ttt_minecraft_b5.bsp") -- Map

end

function AddDir(dir)
	local list = file.FindDir("../"..dir.."/*")
	for _, fdir in pairs(list) do
		if fdir != ".svn" then
			AddDir(dir.."/"..fdir)
		end
	end
	
	for k,v in pairs(file.Find(dir.."/", true)) do
		resource.AddFile(dir.."/"..v)
	end
end

Like this?


if (SERVER) then
	resource.AddWorkshop( "111853609" )
	resource.AddWorkshop( "173953834" )
	resource.AddWorkshop( "182770032" )
	resource.AddWorkshop( "184025769" )
	resource.AddWorkshop( "183313434" )
	resource.AddWorkshop( "113495466" )
	resource.AddWorkshop( "149491742" )
	resource.AddWorkshop( "151479233" )
	resource.AddWorkshop( "123581457" )
	resource.AddWorkshop( "155688712" )
	resource.AddWorkshop( "104548572" )
	resource.AddWorkshop( "185609021" )
	resource.AddWorkshop( "187257499" )
	resource.AddWorkshop( "150455514" )
	resource.AddWorkshop( "104483020" )
	resource.AddWorkshop( "104492363" )
	resource.AddWorkshop( "148628139" )
	resource.AddWorkshop( "177136567" )
	resource.AddWorkshop( "110571239" )
	resource.AddWorkshop( "106516163" )
	resource.AddWorkshop( "187821807" )
	resource.AddWorkshop( "125628460" )
	resource.AddWorkshop( "163221745" )
	resource.AddWorkshop( "115164078" )
	resource.AddWorkshop( "109586003" )
	resource.AddFile("maps/rp_evocity_v2d_sexy_v2.bsp")

end

function AddDir(dir)
	local list = file.FindDir("../"..dir.."/*")
	for _, fdir in pairs(list) do
		if fdir != ".svn" then
			AddDir(dir.."/"..fdir)
		end
	end
	
	for k,v in pairs(file.Find(dir.."/", true)) do
		resource.AddFile(dir.."/"..v)
	end
end

Cuz that doesn’t seem to work either. Like I said, it says all of the addons are downloading, but most of m9k and player models are errors for other people.

They should download everything by using that code, however they need to restart their client for the downloads to mount. So:

Join server -> Download -> Close GMOD -> Join again

I tried that, and my friend restarted his GMOD 5 times and rejoined after each restart, but they’re still errors.

Do you have a workshop collection setted up?

I’m not sure what you mean by that

Do you even have the addons mounted on your server?

You don’t need to mount addons on a server for a client to download them.

Yes, but he might be downloading content to the client, without having it mounted on the server.

I had that issue once back then.

I just set up my workshop collection and added it to my start-up line.
Wish me luck guys