Resource.AddFile question

Hey guys,

I’m working on adding all of my required resources to my game’s init code, and I had a question regarding directories of files.

I know how the addons folder emulates the root garrysmod folder, but say I have content on my server like this:

addons/MYADDON/models
addons/MYADDON/materials

etc.

Can I access files through “addons/MYADDON/models/” when scripting the addfiles?

I will be using the handy directory recursive addfile script from the Wiki, and it warns that simply adding your entire base models folder “models/” is a bad idea, so I was hoping that I could just separate all of the models I need into an addons folder to keep them separate when adding all of those subdirectories.

Hopefully that all made sense…

You should use addons/MYADDON/models/ when searching for the model but only use models/ when calling resource.AddFile

Thanks Ralle, that answers my question!

When you are doing the addfiles, I think you just have to write them as they’re on the FastDL server. You don’t have to mention addons/ at all. Just go straight into models or materials or sounds. So addons/MYADDON/models/weapons/jihad.mdl would become models/weapons/jihad.mdl. Also, make sure that addons you are adding don’t already have a resource.AddFile set aside for them. Sometimes big addons will have a file that comes with them. Wiremod would be an example of this.
Hopefully that helped, I’m presuming that you are doing it for FastDL. :slight_smile:

[editline]10th February 2011[/editline]

Ninja’d.

Yep you presumed correctly, thank you too Caesar I appreciate the help too!