Force Client To Download Models + Etc!

*Re-done entire thread; learned stuff by reading the replies*

Please bump this thread when you’re done reading, so other people can see this thread!

**The Wiki: **[Resource.AddFile](****
In this thread, I’ll be covering, how you make players who connect to your server, download stuff if they dont have it :eng101:

1 - Lets Get Started

Navigate to your garrysmod/garrysmod/lua/autorun/server folder (Incase you dont have the “autorun” or the “server” folder, simply create those), right click and make a new text document.

2 - The Coding

The coding, or whatever you want to call it, is extremely easy to do here, simply write:

resource.AddFile ("the/path/of/model.mdl")


resource.AddFile ("models/barney.mdl")

If the player, who connected to your server, doesent have the barney.mdl file, he will download the 6 model files.

Now, to make them see the model, you have to add the materials (.vtf) files:

resource.AddFile ("materials/models/barney/barney_head_normal.vtf")

And; if you’re running a map, which arent a standard map, you can make them download that too!

resource.AddFile ("maps/rp_evocity_v2d.bsp")

Like that

3 - Saving The File

Hit “Save as…” and name it resource.lua, and put it into your garrysmod/lua/autorun/server folder.

4 - Done!

That’s actually it! Just restart your server and whenever people connect to your server, without having the barney model, they will download all the 6 model files + the materials for him.

5 - Addition

You can also use the AddDir Command, which makes them download the whole directory.
I’m sorry, but I’m not able to explain what it does, cause I… well, cant :doh:

Useful Replies


Easy Method!

Resource Script Generator
Credits to Kogitsune for making it

Rectifing, you only need to add the .mdl model gmod takes care to send all the others!

Really? I didnt know that >:( Damn, the time I could have saved, lol.

And for the people who rated me dumb; in 15 minutes, I answered 4 posts like this - so, I thought it would be easier if someone just made a tutorial, well - frankly I dont care :slight_smile:

Don’t need to do lua files, they are auto.

[lua]resource.AddFile (“lua/weapons/weapon_ak47/shared.lua”)[/lua]

What zé fuck. Use AddCSLuaFile. Note however, that in this case the file is sent automatically.

[lua]resource.AddFile (“lua/weapons/weapon_ak47/shared.lua”)[/lua]

You know we have a wiki for this…

Well, again - I’ve seen many threads asking for this - so I decided just to make a quick tutorial about it.

Well, I could have used this a couple months ago: it’s nice to have it in an accessible place for nubs like we all once were.

2 things:

Isn’t this warez?

Could I download all the CS:S stuff for RP and shit?

  1. Nope.
  2. That would be warez.

The content is available via hlds update tool.

If I set up a server for people who don’t have a certain game, and force their client to download it, and then they copy the stuff into their folder, would THAT be illegal? I don’t want a reply from some 11 year old who thinks he is right, I want a reply from someone who KNOWS the answer.

You cant make them download a game…

I have never heard of someone being able to get the game, as it doesen’t use most of the code and has a completely different style.

Anyway, now all we need to do is get some clientside-gel on this and we can get ALL the content without having to go through outdated and shit links.

No, I mean the content from that game.

A crap load of materials and models a game does not make. :eng101:

He means the content from the game. Not the game itself.

As much as anyone would like to tell you it’s warez or not and whether or not it truly is, it is not illegal, and if it was, you would not and could not be punished.

Ok, thanks :slight_smile:


I’m not going to do this, it was just a question that popped into my head :doh:

The wiki sucks dick. The explanation is fucked up and just stresses you out to the point of killing people.