Force Download

Hello, I am having an issue with Force Download on my server. I have a script that I am using to Force Download models to players as they join the server. It works for my ‘Durgz Mod’ models and ‘Mad Cows Weapons’ models. But, it will not work for player models. I am trying to make ‘NSA Agent’ models and ‘NYPD Players’ models ForceDownload.

  • Model Installation -

materials\models\humans\Male
materials\models\humans\NYPD
materials\models
ypdhat

Models\Humans\NYPD
Materials\Models\player
sa

Models\player

  • This is where I install the models to. It is the correct place. *
  • Force Download Script -

**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

//Durgz Mod Models

AddDir(“models\drug_mod”)
AddDir(“models\ipha”)
AddDir(“models\jaanus”)
AddDir(“models\katharsmodels”)
AddDir(“models\marioragdoll”)
AddDir(“models\smile”)

//Durgz Mod Materials

AddDir(“materials\highs”)
AddDir(“materials\ipha”)
AddDir(“materials\jaanus”)
AddDir(“materials\katharsmodels”)
AddDir(“materials\killicons”)
AddDir(“materials\models”)
AddDir(“materials\smile”)
AddDir(“materials\VGUI”)

//Mad Cows Weapons Materials

AddDir(“materials\entities”)
AddDir(“materials\models”)
AddDir(“materials\scope”)
AddDir(“materials\vgui”)
AddDir(“materials\weapons”)
AddDir(“models\ctf_weapons”)

//Mad Cows Weapons Models

AddDir(“models\items”)
AddDir(“models\weapons”)

//Mad Cows Weapons Sounds

AddDir(“sound\weapons”)

//DarkRP FAdmin Materials

AddDir(“materials\FAdmin”)

//Unique Hud Materials

AddDir(“materials\decals”)

//NYPD Players Materials

AddDir(“materials\models\humans\Male”)
AddDir(“materials\models\humans\NYPD”)
AddDir(“materials\models
ypdhat”)

//NYPD Players Models

AddDir(“Models\Humans\NYPD”)

//NSA Angent Materials

AddDir(“Materials\Models\player
sa”)

//NSA Agent Models

AddDir(“Models\player”)**

That is the script I use for the force download. It works for everything except the ‘NSA Agent’ and ‘NYPD players’ stuff.

When people join my server, they download all the files. But, they do not download the ‘NSA Agent’ and ‘NYPD Players’ models. Can anyone assist me in what is the problem and how to fix? I would be truly thankful. I have asked a few LUA coders. But, they cannot understand why it doesn’t work.

Thanks in advance.

You shouldn’t be trying to add the whole player folder, it can cause issues. You may have to manually add the files with resource.AddFile.

I’d have to agree with divinity, Its probably best to add them all manually. Or place them in the content folder of the gamemode then just add the whole content folder.

[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
[/lua]

Change to:

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

Also, your slashes are backwards.

Also, make sure that

[lua]local list = file.FindDir(dir…"/*", true)[/lua]

is on a new line, or it’ll be treated as part of the comment. It’s probably a copying error but it’s something you’ll want to check.