• FastDL Resource File
    8 replies, posted
i was trying to figure this out, i searched on google for a answer, i found this code [lua]local ClientResources = 0; local function ProcessFolder(Location) for k, v in pairs(file.find(Location .. '*')) do if file.IsDir(Location .. v) then ProcessFolder(Location .. v .. '/') else local OurLocation = string.gsub(Location .. v,'../addons/wire/',") if !string.find(Location, '.db') then ClientResources = ClientResources +1; resource.AddFile(OurLocation); end end end end if !SinglePlayer() then ProcessFolder('../addons/wire/models/'); ProcessFolder('../addons/wire/materials/'); ProcessFolder('../addons/wire/sound/'); end[/lua] Could i do something like [lua]local ClientResources = 0; local function ProcessFolder(Location) for k, v in pairs(file.find(Location .. '*')) do if file.IsDir(Location .. v) then ProcessFolder(Location .. v .. '/') else local OurLocation = string.gsub(Location .. v,'../addons/',") if !string.find(Location, '.db') then ClientResources = ClientResources +1; resource.AddFile(OurLocation); end end end end if !SinglePlayer() then ProcessFolder('../addons/addon1/models/'); ProcessFolder('../addons/addon1/materials/'); ProcessFolder('../addons/addon1/sound/'); ProcessFolder('../addons/addon2/models/'); ProcessFolder('../addons/addon2/materials/'); ProcessFolder('../addons/addon2/sound/'); end[/lua] and have it still download the files?
I don't know but i think this: [B][URL="http://wiki.garrysmod.com/?title=Resource.AddFile"]Resource.AddFile [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B] will work
Not exactly what i was asking, as you can see, resource.addfile is in there [code]resource.AddFile(OurLocation);[/code] i was asking if i could change the code to that and if it would still work
Yes, that should work.
The code doesnt appear to work, doesnt anybody else have a example that would do the same function as that one?
You're not supposed to add the "addons" folder in Resource.AddFile, are you? [editline]09:32PM[/editline] just "models/*"
[QUOTE=Busymonkey;21797205]You're not supposed to add the "addons" folder in Resource.AddFile, are you? [editline]09:32PM[/editline] just "models/*"[/QUOTE] That is correct.
[url]http://www.facepunch.com/showthread.php?t=842886[/url] Make your list ahead of time.
Not exactly what i wanted, but pretty much perfect, Lol Thanks
Sorry, you need to Log In to post a reply to this thread.