How do I force content to be downloaded?

Post Reply
User avatar
kraze
Former staff
Former staff
Posts: 4362
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Fri Sep 17, 2010 9:06 am
Location: California

How do I force content to be downloaded?

Post by kraze »

To do this you will need to use a LUA file.
  1. Connect to your server FTP by using the connection info on the "File Manager" tab
  2. Navigate to garrysmod/lua/autorun/server/
  3. Create a new "Example.lua" file.
  4. Then add this code for each custom file "resource.AddSingleFile("file path here")"
  5. For each workshop addon added via a collection add "resource.AddWorkshop("workshopid")"
As example of this would be..

Code: Select all

   resource.AddSingleFile( "sound/siege/jihad.wav" )
   resource.AddSingleFile( "sound/siege/big_explosion.wav" )
   resource.AddSingleFile( "materials/vgui/entities/weapon_jihadbomb.vtf" )
   resource.AddSingleFile( "materials/vgui/entities/weapon_jihadbomb.vmt" )
   
   resource.AddWorkshop( "157450041" )
   resource.AddWorkshop( "158962453" )
Save the file, run a websync and your files should be force downloading now.

We have also created a very handy tool to automatically generate a resource.lua file for you. http://www.configcreator.com/create/gmod/resources.lua

Information sourced from http://maurits.tv/data/garrysmod/wiki/w ... xd2d2.html and http://maurits.tv/data/garrysmod/wiki/w ... x5809.html
@Kraze^NFo> Juski has a very valid point
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
User avatar
kraze
Former staff
Former staff
Posts: 4362
Joined: Fri Sep 17, 2010 9:06 am
Location: California

Re: How do I force content to be downloaded?

Post by kraze »

We've seen a few people who have tried force downloading map files to clients. Do not do this as it will require all clients who do not have the maps to download them all before joining.

When the server switches to a custom map that the client does not have it will automatically start downloading it for them.
@Kraze^NFo> Juski has a very valid point
@Juski> Got my new signature, thanks!
@Kraze^NFo> Out of context!
@Juski> Doesn't matter!
@Juski> You said I had a valid point! You can't take it back now! It's out there!
Post Reply