Server addons force download


I got my own server with my friends and in my server I use my downloaded addons/models/plugins/props/(insert random stuff here)

And when my friend joins my server that is hosted from MY own computer where all my downloads stuff is I want the server to force them to download the same things that I have so that they dont end up seeing a bunch of errors in the map

Is this even possible?


resource.AddFile(" ")

Use it on models and materials. It’ll download the related files automatically.

resource.AddSingleFile(" ")

Use that for sounds.

Ok great but where do I add this code?

You can add them in your gamemode’s server-side lua file. (init.lua)
Or, place them all in a script in lua/autorun/server, that way it keeps your gamemode files clean

Like this:

Thank you I will try it out and report back!

[editline]22nd December 2012[/editline]

Okay so I tried inserting this into a init.lua file


And I inserted it into


Which did not change anything. My friend joined and still an error

Then I tried to create a folder named lua in my garrys mod folder and then the bunch of other folders you told me to add inside making it

D:\SSD Program\steamapps homja1\garrysmod\garrysmod\lua\autorun\server\

And in there I added the .lua file but my friend still did not see my model.

Ah! Workshop addons, even easier.

In your root directory (garrysmod/garrysmod), create a file called workshop.vdf. In there, you’ll take that number that’s in the gma file name and put it like this:

     "1"      "111570226"      --Soul Caliber IV

When you start a multiplayer session, that file will be called and that content made available.

You shouldn’t even need a resources file with this.

Also, when you use resource.AddFile, you only point it to models, materials, sounds, etc.
When the addon loads, the models, materials, etc folders in the addon are temporarily linked to the root model, material, etc. folders, so you would add them from there.

Did it, but my friend still does not get download the content :confused:

PM me through skype so we can talk in there. I will post the fix here later when/if we find it.


Dont use , use /

What place are you talking about?

I feel like there is a thread like this every single page, but no one has actually fully with one long post ever cleared this up. I get so many solutions, but none of them ever work. It would be awesome if someone to the time to explain to us this so that we will never have to see another one of these generic threads again.

If you have a .gma file uploaded through the workshop.vdf, just treat the content as if it were in the root file. FastDL’ing content from a .gma is very time consuming though, and it’s incredibly silly to attempt. Until Garry adds a better way of handling .gma content transfer though, it will have to do.

You can’t download the .gma to clients, you can only download the content inside the .gma.

Is it possible to force subscribe workshop addons to players?


Yes you can. That’s how I’m running the GryMod HUD on my server.

Use a tool like GMadConvGUI to unpack the gma file. It breaks down like any other addon, into materials, models and sounds. Add those files to a AddFile script and you’re good to go.

This isn’t what he was asking. You can’t force a player to subscribe to an addon, however, yes, you can unpack the .gma file and get the proper files set up with FastDL, but it’s a hassle and Garry doesn’t support it. It’s your only option until Garry adds a legitimate way to do it.

Okay cool. But does anyone know how to get resource.AddFile working itself?

You make a file in your server’s autorun folder called whatever you want it to be, such as resources.lua, and in it you want to paste this:

print(“Resources mounted.”);[/lua]

Obviously, replace the “FILEPATH” with whatever the path of the files you want to add are.

Add the line to your init, or make a separate script in /lua/autorun/server and put them in there.
Make sure to use / and not \ in your file paths. And remember that your base folder is garrysmod/garrysmod, so it would be like this:


On a dedicated server, you will need to merge the sub-folders of your addons into the garrysmod root folder, so they populate into the materials, models and sound folders.

EDIT:Whoops, guess I’m a little late. Had this typed up and forgot to submit.

Okay, I got it to work, but I get this material issue with a shader not being bound.

I’ve also had that happen to me, but the issue appeared sporadically and could never recreate it. Just restart the server.
:confused: Sorry I can’t help beyond that.