Force Downloading

Well, I’m having trouble with getting a player to download files. The player will download the files yet they will not have the .vvd or .phy file in their models folder. The model in game is either invisible or a error to them. We’ve been trying to fix this for a good three days now with no success.

Also, we have tried switching the backward slashes with forward slashes, when forward slashes are in place the model is invisible. When backward slashes are in place the model is an error.

[lua]
resource.AddFile(“materials\vgui\entities\golf gti.vmt”)
resource.AddFile(“materials\vgui\entities\golf.vtf”)
resource.AddFile(“materials\golf\badges.vmt”)
resource.AddFile(“materials\golf\badges.vtf”)
resource.AddFile(“materials\golf\black.vmt”)
resource.AddFile(“materials\golf\black.vtf”)
resource.AddFile(“materials\golf\bottom.vmt”)
resource.AddFile(“materials\golf\bottom.vtf”)
resource.AddFile(“materials\golf\brake_disk2.vtf”)
resource.AddFile(“materials\golf\brake_disk.vmt”)
resource.AddFile(“materials\golf\brake_disk.vtf”)
resource.AddFile(“materials\golf\chrome.vmt”)
resource.AddFile(“materials\golf\chrome.vtf”)
resource.AddFile(“materials\golf\front_light.vmt”)
resource.AddFile(“materials\golf\front_light.vtf”)
resource.AddFile(“materials\golf\glass.vmt”)
resource.AddFile(“materials\golf\glass.vtf”)
resource.AddFile(“materials\golf\glass_inside.vmt”)
resource.AddFile(“materials\golf\glass_inside.vtf”)
resource.AddFile(“materials\golf\interior.vmt”
resource.AddFile(“materials\golf\interior.vtf”)
resource.AddFile(“materials\golf\misc.vmt”)
resource.AddFile(“materials\golf\misc.vtf”)
resource.AddFile(“materials\golf\misc_mask.vtf”)
resource.AddFile(“materials\golf\rear_light.vmt”)
resource.AddFile(“materials\golf\rear_light.vtf”)
resource.AddFile(“materials\golf\skin1.vmt”)
resource.AddFile(“materials\golf\skin1.vtf”)
resource.AddFile(“materials\golf\skin2.vmt”)
resource.AddFile(“materials\golf\skin2.vtf”)
resource.AddFile(“materials\golf\skin3.vmt”)
resource.AddFile(“materials\golf\skin3.vtf”)
resource.AddFile(“materials\golf ire.vmt”)
resource.AddFile(“materials\golf ire.vtf”)
resource.AddFile(“materials\golf race.vmt”)
resource.AddFile(“materials\golf race.vtf”)
resource.AddFile(“materials\golf\wheel.vmt”)
resource.AddFile(“materials\golf\wheel.vtf”)
resource.AddFile(“materials\golf\wheel_mask.vtf”)
resource.AddFile(“models\golf\golf.dx80.vtx”)
resource.AddFile(“models\golf\golf.dx90.vtx”)
resource.AddFile(“models\golf\golf.mdl”)
resource.AddFile(“models\golf\golf.phy”)
resource.AddFile(“models\golf\golf.sw.vtx”)
resource.AddFile(“models\golf\golf.vvd”)

[/lua]

Well, first off would check to make sure the vvd and phy files are actually in the directory specified on your resource.AddFile() function.

Next, (I’m not sure if this will work, but I have seen it in other code) try using resource.AddModel().

Oh! And don’t use back slashes, use forward slashes.

I hope this fixes your problem! :dance:

Ok, we tried it. The cars are now invisible. The .vvd and .phy file are still missing from the players model folder, yet when loading it says that you download them. The files are in the servers path.

Where is the LUA file located in your server directory that you are using with this code?

I doubt that it is the file but it is in autorun for the server.

Ok, are the models in tha ACTUAL garrysmod/models folder or are they in addons/vehiclepack/models?

If the latter, then you have to put the whole directory I’m afraid.

They’re in garrysmod/models. What do you mean by latter.

A hint for the future to make your life so much easier (change your above code to 4 lines):

[lua]resource.AddFile(“materials/vgui/entities/golf_gti.vmt”)
resource.AddFile(“materials/vgui/entities/golf.vtf”)
for _,v in ipairs(file.Find("…/materials/golf/")) do resource.AddFile(v) end
for _,v in ipairs(file.Find("…/models/golf/
")) do resource.AddFile(v) end[/lua]

Thank you for the “Efficient” code. For some reason the model is still invisible to all players whom download it server side.

The resource.AddFile is working fine. Your problem is one of these:

  1. The files necessary to make the model show up don’t exist on the server.
  2. The models are inherently flawed for whatever reason.

Well, I’m not sure if this has to do with anything but we tried this with three models along with people who’ve downloaded the server files via our upload link see it fine.

I’ve had this same problem with my server.

I think it is the new update.

The car models and materials are tricky to get them to download.

I cannot get anything auto dl from my server ;/
Please someone help me, i cant even use other sweps, because clients get error.
And thats why i need it to AUTO DL, please anyone??

steam: MariusAasgaard