Gamemode Content

Hey Guys.

If I create a complete gamemode with Models and sounds.
can I start a download from the gamemode/content folder or should i copy my files to the rootdirectory of the server?

If i add a file from gamemode/content/materials/…
Gmod download the file but stop continue downloads.

Put it in gamemode/content if you want others to have it…

yes but how i have to set the download?
it doesnt download automatical the skin -.-

**[G.AddCSLuaFile

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.AddCSLuaFile)**
**[Resource.AddFile

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Resource.AddFile)**

[lua]function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("…/"…dir…"/*")
for _, fdir in pairs(list) do
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(dir…"/"…fdir)
end
end

for k,v in pairs(file.Find("../"..dir.."/*")) do
	resource.AddFile(dir.."/"..v)
end

end

AddDir(“models/yourmodels”)[/lua] - From Wiki

set it up like that but the problem is that ive got models with skins FOR the gamemode.
so every player who connect get the files from my Gamemode folder.
but when i add the file “models/weapons/v_desert.mdl” it doenst download.
and with “gamemodes/*******/content/models/weapons/v_desert.mdl” it downloads only the first file and stop …
what can i do? i doesnt want to copy my gamemode specific models/skins into the normal models/material folders.

You have to create a resource for every single file.

don’t send people skins.

okay now ive done this :

ive created a file (“resource.lua”) with this text


if SERVER then
	local path = "../"..GM.Folder.."/content"
	local folders = {""}
	while true do -- This does not trigger the infinite loop protection. I use it myself with a large content list without any problems. ~Lexi
		local curdir = table.remove(folders,1)
		if not curdir then break end
		local searchdir = path..curdir
		for _, filename in ipairs(file.Find(searchdir.."/*")) do
			if filename ~= ".svn" then
				if file.IsDir(searchdir.."/"..filename) then
					table.insert(folders,curdir.."/"..filename)
				else
					resource.AddSingleFile(string.sub(curdir.."/"..filename,2))
				end
			end
		end
	end
end

it should add all the files in my content folder with subfolders.

i writen in my server “developer 1” and “downloaddebug 1”
after that i saw
[resource.AddFile] File models\weapons\v_rif_desert.mdl didn´t exist!

BUT when it doesn´t exist, how could my script find the file ?

EDIT :

I think its an error with the virtual folder tree. normaly the content folder will be mounted as materials/models etc.

@ LauScript
don’t send people skins. -> its a Hexed Model with an own Materialfile.

EDIT 2 :

Think ive got it. you need a completed info.txt else the download wont added