Resource.Addfile help :)

Hi facepunch.

I just have a question about a new update i just made with my steamcmd server.

I just updated my server and it seems to work but when i joined it I see something changed with my weapons share.lua.

It seems that all resource.AddFile(“models/weapons/v_rif_famas.mdl”) (that was an exsampel :smiley: ) it creating script errors and I cant find out why it does that.

I think maybe because the …/garrysmod/models/weapons have changed but when i dont know more about it then im not sure

Here is a link to what errors i get :slight_smile: Click here sexy :wink:

Thanks for your help and time on my thread. its all appreciated :slight_smile:

Edit: maybe its because its all the css models??? just wondering :slight_smile:

resource.AddFile is a serverside only function. Because you put it in shared.lua the clients also try to run it (The Lua errors you see there are coming from a client, not the server itself, that’s why there’s a name above them). Either move all the resource.AddFile’s to init.lua, or change it so it’s like:



if SERVER then
  resource.AddFile("some/file.vmt")
  resource.AddFile("herp/derp.mdl")
end


Im getting this too… Everything that uses resource.AddFile seems to be spewing out that error…

Thanks you so much :D… you just saved my ass :wink:

i just moved the resource.AddFile(“models/weapons/v_“weapon”.mdl”) (exsampel again :slight_smile: under the If server then :smiley:
Thanks :slight_smile:

EDIT: this count of all the errors I had. great help thanks so much :slight_smile:

2Edit: I let the thread be open if anyone els have the same problem… just in case :slight_smile:

How would this work with models?

The same



if SERVER then
  resource.AddFile("path/to/your/model.mdl")
end


Nvm :smiley:

EDIT: just nvm… :smiley:

You can resolve the thread yourself on the page