To do this you will need to use a LUA file.
- Connect to your server FTP by using the connection info on the "File Manager" tab
- Navigate to garrysmod/lua/autorun/server/
- Create a new "Example.lua" file.
- Then add this code "resource.AddFile("file path here")"
Save the file, run a websync and your files should be force downloading now.
As an alternative to manually specifying files, you can use this code to add everything in a certain directory. The code below would add everything in the content folder.
Code:
local path = "../"..GM.Folder.."/content"
local folders = {""}
while true do
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
If you want to force-add any related files this function will automatically add any other files that are related to the selected one, and throw an error if it can't find them. For example, a .vmt file will automatically add the .vtf with the same name, and a .mdl file will automatically add all .vvd, .ani, .dx80.vtx, .dx90.vtx, .sw.vtx, .phy and .jpg files with the same name, with a separate error for each missing file. (This can lead to spamming the consoles of potential players)
Code:
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.."/*", true)) do
resource.AddFile(dir.."/"..v)
end
end
AddDir("models/yourmodels")
Information sourced from http://maurits.tv/data/garrysmod/wiki/w ... xd2d2.html and http://maurits.tv/data/garrysmod/wiki/w ... x5809.html