Advertisement
Soulreaper099

lawlawlawl

Feb 3rd, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.58 KB | None | 0 0
  1. This guide assumes you know about where things go on a server and how to use basic FTP functionality.
  2.  
  3. Fast Download URLS and setup.
  4.  
  5. First off, You need a half decent FTP client. Personally, I use Filezilla. You can get it at http://filezilla-project.org/. This guide assumes you have a Fast dl/webserver to use with FTP access.
  6.  
  7. Config Setup
  8. Alright first off, we need to tell Gmod where to go and fetch these files. To do this, go to your servers FTP directory and go find the addons folder. It can vary how many folders you have to go through. If you have a rented server from a host, you'll probably have something like
  9. IP:PORT/[color=red]Orangebox/[/color]Garrysmod/addons-Materials-Models etc. Some hosts skip the parts in red cause they're lazy, but if running a dedi, then you should already know the GMod path.
  10. Anyway, navigate to your cfg folder and open/right-click > View/Edit in filezilla. At the bottom of the file add this line
  11.  
  12. sv_downloadurl "[color=red]http://www.myurl.co.uk/garrysmod/[/color]"
  13. Change the bolded part to the URL which is something like http://www.URL-HERE.co.uk/garrysmod/.
  14. Save and upload it, and with any luck it should now have defined the url to use for sending clients to download stuff.
  15.  
  16. Note the garrysmod part on the end. When connecting via FTP to the webserver you will usually end up at the root. From there on, make a garrysmod folder (right click > new/create directory) - That is where everything that needs to be uploaded will be heading into, almost like a mirror of the game server.
  17.  
  18. LUA Files
  19. In order for people to download the lua files properly, they need to be taken from the game server's cache, downloaded, and reuploaded to the fast download. For example, I have my URL set as http://kazuos-server.ukgame.co.uk/. Within that on the FTP [which is how you upload the files] I have a folder called garrysmod, and within that, a cache folder, so the end url looks like http://kazuos-server.ukgame.co.uk/garrysmod/cache.
  20.  
  21. You have to redownload and reupload it every time you make a clientside lua modification to the server, usually every time you update an addon or gamemode.
  22. In step form.
  23.  
  24. 1. Create a folder in your client gmod directory called "cache fast dl"
  25. 2. Go to your game servers' FTP, and go into the garrysmod/cache folder. Copy the dua folder into the cache fast dl folder you created in the last step and download it to there.
  26. 3. Once that is done, connect to your fast dl FTP. Make sure you have it set up so at the root, you can see a folder called garrysmod and within that, a cache folder. Upload the recently created dua folder to to WITHIN the cache folder.
  27. 4. Hey presto, providing you've set up the url location in one of the configs correctly, people can now download lua files faster.
  28.  
  29. Materials/Models/Sounds within Addons/Game modes
  30. So, say for example you want people to download new wiremod models so they don't b*tch about errors and sh*t. Instead of manually adding each and every file with resource.AddFile, there's some coding you can use.
  31.  
  32. local ClientResources = 0;
  33. local function ProcessFolder ( Location )
  34. for k, v in pairs(file.Find(Location .. '*')) do
  35. if file.IsDir(Location .. v) then
  36. ProcessFolder(Location .. v .. '/')
  37. else
  38. local OurLocation = string.gsub(Location .. v, '../addons/wire/', '')
  39.  
  40. if !string.find(Location, '.db') then
  41. ClientResources = ClientResources + 1;
  42. resource.AddFile(OurLocation);
  43. end
  44. end
  45. end
  46. end
  47.  
  48. if !SinglePlayer() then
  49. ProcessFolder('../addons/wire/models/');
  50. ProcessFolder('../addons/wire/materials/');
  51. ProcessFolder('../addons/wire/sound/');
  52. end
  53. That's just an example. For gamemodes, it's slightly different. For example, in the Resident Evil Garrysmod gamemode, in resources.lua,
  54.  
  55. local ClientResources = 0;
  56. local function ProcessFolder ( Location )
  57. for k, v in pairs(file.Find(Location .. '*')) do
  58. if !string.find(Location, ".svn") then
  59. if file.IsDir(Location .. v) then
  60. ProcessFolder(Location .. v .. '/')
  61. else
  62. local OurLocation = string.gsub(Location .. v, '../gamemodes/' .. GM.Path .. '/content/', '')
  63.  
  64. if !string.find(Location, '.db') then
  65. ClientResources = ClientResources + 1;
  66. resource.AddFile(OurLocation);
  67. end
  68. end
  69. end
  70. end
  71. end
  72.  
  73. GM.Path = "RE";
  74. if !SinglePlayer() then
  75. ProcessFolder('../gamemodes/' .. GM.Path .. '/content/models/');
  76. ProcessFolder('../gamemodes/' .. GM.Path .. '/content/materials/');
  77. ProcessFolder('../gamemodes/' .. GM.Path .. '/content/sound/');
  78. end
  79. I've bolded parts that can/need to be changed before they will work. You can choose to just dump them in the autorun folder with different names, or you can put them in the addon/gamemode that has content being downloaded respectively, named resources.lua [when it comes to addons, just put it in AddonName/lua/autorun]
  80.  
  81. So far, that's got them queued for download, but it's no good if the files themselves aren't on the fast dl!
  82.  
  83. Because of the way GMOD/Source handles the download URL, it expects all the content and stuff to be rooted in the garrysmod folder (or so I've experienced) e.g. garrysmod/materials, garrysmod/models etc. NOT WITHIN AN ADDONS FOLDER ON THE URL. The only time you should stick something in addons on the webserver is when a map refuses to download via the first method. Basically, all you need to do is go to each addon that has content queued on the gameserver [or for streamlining, if the server is using the same stuff as your client, then skip this next part] and copy/download the materials/models/sounds from within them to your client.
  84. From there, Upload those folders to the fast download within the garrysmod folder, so you got garrysmod/materials, garrysmod/models etc.
  85. If the content you're uploading sits on the gameserver in the materials and models folder rooted on garrysmod, then you just need to mirror them onto the fast download.
  86. With any luck, You're now all set to work.
  87.  
  88. NOTE. Do not try and add too many addons to the queue with the LUA coding, otherwise the table gets overloaded, and your server will refuse to start.
  89.  
  90. I believe this guide is done. I might add to it and supply images, but it's done for now.
  91.  
  92. Made 100% by me, myself and I.
  93. I made this about 2-3 months ago and posted it around on xuras.net and pulsar effect. I was gonna post it here at some point but I didn't want to get slandered. This guide *should* contain everything needed to know, however if something is missing do tell me.
  94.  
  95. EDIT: Oh snap I appear to have missed an entire section on maps.
  96.  
  97. Basically, Look up how to bzip maps on google. Once they're all bzipped, upload them to the webserver under garrysmod/maps - If that doesnt work try putting it in addons if the map was orignally in an addon format.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement