I've recently opened a server and I want my players to automatically download content like Models and sounds.
I've looked around and found this piece of code that I've modified.
[QUOTE]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/Guitarosta")
AddDir("materials/models/Guitarosta")
AddDir("sound/kitay")
[/QUOTE]
The problem is, where do I put the lua, and what shall I name it? And does it work with Gmod 13?
Source:
[URL]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5809.html[/URL]
Make a Lua file in your lua/autorun/ folder.
And I'm pretty sure it won't work.
if its a dedicated server put it in "garrysmod/lua/autorun/server/" and name it "forceddownloads.lua"
Sorry, you need to Log In to post a reply to this thread.