Help with 'resource.AddFile( "" )

Hello, I am trying to add a car to my DS through FileZilla and the car category appears but when I spawn the car it’s an error. I thought I could do the generic file paths. Am I missing something?

Here is what I have so far:


resource.AddFile( "materials/sentry/c7" )
resource.AddFile( "models/sentry" )
resource.AddFile( "scripts/vehicles" )
resource.AddFile( "sound/vehicles/sgmcars/c7/" )
resource.AddFile( "lua/autorun/" )


You have to add specific files, not just directories. Also, don’t include lua files.

Thanks, but by specific files, do you mean like every: model file (vtx, dtx,) and (vtf + .vmt)

[editline]6th July 2014[/editline]

[del]Also, for sound, do I have to add every sound file also?[/del]

Lua: You do not resource.AddFile lua files.
Maps: You do not resource.AddFile maps, however they still have to be in your download server.
Materials: Just add .vmt’s and .vtf’s of the same name will be added. If a .vtf doesn’t have a matching .vmt, add the .vtf.
Models: Just add the .mdl file; all compliments will automatically be added.
Scripts: Add new files only, not default ones.
Sound: Add every file.

Doesn’t work, it’s like I didn’t even upload the files.

If it helps, I have the actuall materials and models and such in my server’s addon folder.

You have an sv_downloadurl, right?

[del]Yes, I use it for a loading screen[/del]

Realised my own stupidity within seconds…

Yes, I believe I do.

No, that’s sv_loadingurl.

[editline]6th July 2014[/editline]

Post your sv_downloadurl then.

sv_downloadurl “http://fastdl.sycoticgaming.net/server

[editline]6th July 2014[/editline]

>from my server.cfg

That looks good. Post your code now and it’s location.

GarrysMod/garrysmod/lua/autorun/dwnld.lua OR /garrysmod/lua/autorun/dwnld.lua



--  Materials

resource.AddFile( "materials/sentry/c7/lights.vtf" )
resource.AddFile( "materials/sentry/c7/lights_nm.vtf" )
resource.AddFile( "materials/sentry/c7/needle.vmt" )
resource.AddFile( "materials/sentry/c7/tex_0039_2.vmt" )
resource.AddFile( "materials/sentry/c7/tex_0039_2_bump.vtf" )
resource.AddFile( "materials/sentry/c7/tex_0043_2.vmt" )
resource.AddFile( "materials/sentry/c7/tex_0043_2_nm.vtf" )
resource.AddFile( "materials/sentry/c7/tex_0047_2.vmt" )
resource.AddFile( "materials/sentry/c7/tex_0094_2.vmt" )
resource.AddFile( "materials/sentry/c7/tex_0095_2.vmt" )
resource.AddFile( "materials/sentry/c7/tex_0095_2_nm.vtf" )
resource.AddFile( "materials/sentry/c7/tire.vmt" )
resource.AddFile( "materials/sentry/c7/tire_bump.vtf" )
resource.AddFile( "materials/sentry/c7/wheel.vmt" )

-- Model

resource.AddFile( "models/sentry/c7.mdl" )

-- Script

resource.AddFile( "scripts/vehicles/sentry/c7.txt" )

-- Sounds

resource.AddFile( "sound/vehicles/sgmcars/c7/first.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/fourth_cruise.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/idle.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/rev.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/second.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/start.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/stop.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/third.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/throttle_off.wav" )
resource.AddFile( "sound/vehicles/sgmcars/c7/throttle_off_fast.wav" )



Move it to lua/autorun/server. Also, make sure sv_allowdownload is set to 0 in your server.cfg.

Okay, and that second part seems odd, care to explain why it is set to zero if it allows downloads?

It enables ServerDL, which instead of downloading from your webhost, will download files directly from your server with a 1mb/s speed (iirc) and a maximum size of 64mb/file.

Ah got it.

[editline]6th July 2014[/editline]

Well, it still doesn’t work. I spawn it and it’s an error.

Check your client console for any HTTP errors.

This is all I saw:





```html
 Uncaught TypeError: Cannot read property 'style' of null
Requesting 9 lua files from the server


I just looked on your FastDL were and c7.mdl is not BZiped.

I have no idea what that is. Sorry :frowning:

Ask your host on how to pack files into .bz2’s then. I noticed most already were, but that specific one wasn’t.