Auto download Server

Hello people…
How do i do so when people join my server, they dont need to download the vehicles from garrysmod.org

But from my server?
do i need to add every file manual? or is there a smart way.

i got this resource.AddFile(“materials/models/sf_block_black.vmt”)

??

Please help
Sorry if i am wrong.

EDIT: and should it have a speciel name?

You need to add every file manually to a lua file in autorun or autorun/server, I don’t remember exactly where but you have to resource.AddFile all the models and materials and sounds.

Thanks, ehm but i have added this…

[lua]
resource.AddFile(“models/corvette/corvette.dx80”)
resource.AddFile(“models/corvette/corvette.dx90”)
resource.AddFile(“models/corvette/corvette.mdl”)
resource.AddFile(“models/corvette/corvette.phy”)
resource.AddFile(“models/corvette/corvette.sw”)
resource.AddFile(“models/corvette/corvette.vvd”)
resource.AddFile(“scripts/vehicles/corvette.txt”)
resource.AddFile(“material/corvette/glass_inside.vtf”)
resource.AddFile(“material/corvette/interior.vmt”)
resource.AddFile(“material/corvette/interior.vtf”)
resource.AddFile(“material/corvette/misc.vmt”)
resource.AddFile(“material/corvette/misc.vft”)
resource.AddFile(“material/corvette/rear_light.vmt”)
resource.AddFile(“material/corvette/rear_light.vtf”)
resource.AddFile(“material/corvette/skin1.vmt”)
resource.AddFile(“material/corvette/skin1.vtf”)
resource.AddFile(“materials/vgui/entities/corvette.vtf”)
resource.AddFile(“materials/vgui/entities/corvette c6.vmt”)
[/lua]

Is it like that?
Beacuse nothing happening…

[lua]
resource.AddFile(“material/vgui/entities/corvette.vtf”);
resource.AddFile(“material/vgui/entities/corvette c6.vmt”);
resource.AddFile(“material/corvette/glass_inside.vtf”);
resource.AddFile(“material/corvette/interior.vmt”);
resource.AddFile(“material/corvette/interior.vtf”);
resource.AddFile(“material/corvette/misc.vmt”);
resource.AddFile(“material/corvette/misc.vft”);
resource.AddFile(“material/corvette/rear_light.vmt”);
resource.AddFile(“material/corvette/rear_light.vtf”);
resource.AddFile(“material/corvette/skin1.vmt”);
resource.AddFile(“material/corvette/skin1.vtf”);
resource.AddFile(“material/corvette/badges.vmt”);
resource.AddFile(“material/corvette/badges.vtf”);
resource.AddFile(“material/corvette/black.vmt”);
resource.AddFile(“material/corvette/black.vtf”);
resource.AddFile(“materials/vgui/entities/corvette.vtf”);
resource.AddFile(“materials/vgui/entities/corvette c6.vmt”);
resource.AddFile(“material/corvette/brake_disk.vmt”);
resource.AddFile(“material/corvette/brake_disk.vtf”);
resource.AddFile(“material/corvette/chrome.vmt”);
resource.AddFile(“material/corvette/chrome.vtf”);
resource.AddFile(“material/corvette/front_light.vmt”);
resource.AddFile(“material/corvette/front_light.vtf”);
resource.AddFile(“material/corvette/glass.vmt”);
resource.AddFile(“material/corvette/glass.vtf”);
resource.AddFile(“material/corvette/glass_inside.vmt”);
resource.AddFile(“material/corvette/glass_inside.vtf”);
resource.AddFile(“material/corvette/skin2.vmt”);
resource.AddFile(“material/corvette/skin2.vtf”);
resource.AddFile(“material/corvette/skin3.vmt”);
resource.AddFile(“material/corvette/skin3.vtf”);
resource.AddFile(“material/corvette/skin_s.vtf”);
resource.AddFile(“material/corvette/tire.vmt”);
resource.AddFile(“material/corvette/tire.vtf”);
resource.AddFile(“material/corvette/trace.vtf”);
resource.AddFile(“material/corvette/trace.vmt”);
resource.AddFile(“material/corvette/wheel.vtf”);
resource.AddFile(“material/corvette/wheel.vmt”);
resource.AddFile(“material/corvette/wheel_mask.vtf”);
resource.AddFile(“models/corvette/corvette.dx80”);
resource.AddFile(“models/corvette/corvette.dx90”);
resource.AddFile(“models/corvette/corvette.mdl”);
resource.AddFile(“models/corvette/corvette.phy”);
resource.AddFile(“models/corvette/corvette.sw”);
resource.AddFile(“models/corvette/corvette.vvd”);
[/lua]
Thats what i used my time on, i can see the car form. But the textures is totally bugged…
Can anyone help me?

There’s a module to get matierial imports from models, search for it. Then just loop through the returned materials.

Can’t find it, could you try it?

Kodex, lol!!
You told me you had the auto dl.
Then, you want me to help you?

You need to load all of your resources at the very beginning of your gamemode, like in the init.lua file.

You can use a loop to add all of your resource files so you dont have to manually add each one. Something like this:


for _,v in ipairs(file.Find("..materials/gmod/*")) do resource.AddFile(v) end

this will add all files in the materials/gmod/ folder.

thanks but i dont know what u actually mean :S

[editline]02:39PM[/editline]

So it means

[lua]for _,v in ipairs(file.Find("…materials/corvette/*")) do resource.AddFile(v) end[/lua]

[lua]
for _,v in ipairs(file.Find("…/materials/corvette/*")) do
resource.AddFile(v)
end
[/lua]

Same thing, I guess it looks a little better on multiple lines, but yeah, thatll make that a whole lot faster :stuck_out_tongue:

It is not the same since he had …materials!