• resource.AddFile and FastDL
    10 replies, posted
Okay, so I was having this thought, the resource.AddFile is placed on the game server under lua > autorun > server. It can look like this [code] resource.AddFile("models/mic.dx80") resource.AddFile("models/mic.dx90") resource.AddFile("models/mic.mdl") resource.AddFile("models/mic.phy") resource.AddFile("models/mic.sw") resource.AddFile("models/mic.vvd")[/code] It specifys which content to be downloaded. But do the clients download the content from the game server or through the FastDL server which is connected via sv_downloadurl? FastDL is basically useless if the content is downloaded from the gamerserver. Can someobody please clarify or confirm this for me.
As far as I know, the FastDL server is checked first for the content, and if found, it'll be downloaded from there. If it's not found, it'll fall back onto the gameserver. Remember though, if that is content from a gamemode, or addon, the model files will need to be copied directly into the garrysmod/ root on the FastDL server.
resource.AddFile("models/mic.mdl") You don't need the others.
If the file is not found on the webserver that the FastDL is on, then a 0 byte file will be created in it's place. sv_downloadurl completely turns off downloading from the game server.
[QUOTE=Freze;26800735]resource.AddFile("models/mic.mdl") You don't need the others.[/QUOTE] Ah okay. Thanks for your help everyone. With the resource.AddFile can you add directories and individual files in the same document? Like this: [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.."/*")) do resource.AddFile(dir.."/"..v) end end AddDir("materials/entities") AddDir("materials/highs") AddDir("materials/ipha") AddDir("materials/jaanus") AddDir("materials/katharsmodels") AddDir("materials/killicons") AddDir("materials/smile") AddDir("materials/vgui") AddDir("materials/weapons") resource.AddFile("models/player/group01") resource.AddFile("models/player/group02") resource.AddFile("models/player/group03") [/code]
If you're using it for a gamemode, you gotta stick that into the gamemode's main folder, and paste it into the init.lua Example: DarkRP>Gamemode>init.lua
[QUOTE=lolcheese;26869693]If you're using it for a gamemode, you gotta stick that into the gamemode's main folder, and paste it into the init.lua Example: DarkRP>Gamemode>init.lua[/QUOTE] I am not sure what you mean. So I put it in the init.lua if the content people are download is being used in a gamemode. The models and materials I want the clients to download are for DarkRP models. So I paste it in the gamemode>init.lua file?
Dude I fucking love you! You have just solved months of my FastDL issues. Thank you so much, why didn't anyone just say where to put the file.
We didn't know you were editing a gamemode..
Eh, no problem. I've had the same problem before. But then a user named teddi orange solved that problem for me, so I do owe my gratitude to him.
[QUOTE=lolcheese;26869693]If you're using it for a gamemode, you gotta stick that into the gamemode's main folder, and paste it into the init.lua Example: DarkRP>Gamemode>init.lua[/QUOTE] thank you. this is great :)
Sorry, you need to Log In to post a reply to this thread.