• Workshop Tutorial (Downloading files on to your server)
    4 replies, posted
Hello everyone. I've recently seen a bunch of people on the forums having trouble with their server downloading files fully. This tutorial is going to show you how to set up a fast, and yet efficient way to download files fully to your Garrys Mod server. I hope this helps [B]Part 1 - Setting up resource.lua: [/B] Firstly what you're going to want to do is open up your text editor that you use (your decision of what to use :D). Once your editor is up go ahead,and save the file as resource.lua. Save this to where ever you would like for the time being. Right,now lets get to the part of adding the code to the document :dance: [B]Part 2 - Adding the Code:[/B] Now that you have the document saved and ready to add the code let me show you it (down below) [CODE]resource.AddWorkshop( string workshopid ) [/CODE] --Okay so if you're confused about the argument called [B]string workshopid[/B] I will explain it to you. this part [CODE]string[/CODE] basically means this[CODE]""[/CODE] so instead of string you would put this around workshopid "". So now it would look like this [CODE]resource.AddWorkshop( "workshopid" )[/CODE] So don't get confused about string :D. [B]Part 3 -Finding Addons: [/B] Now once you have that code set up in your document it's time to find the addon you wont! So go ahead, and head to the workshop, and find an addon you would like to add to your server. Once you have found the addon you wont look near the top at the url bar. There you should see the url of the addon. Now in that addon you should see a couple of numbers near the end of the url. That is the id of the addon copy that. [B]Example URL[/B] [CODE]http://steamcommunity.com/sharedfiles/filedetails/?id=167161694&searchtext=[/CODE] [B]Example ID[/B] [CODE]167161694[/CODE] [B]Part 4 - Adding the addon to your server:[/B] Now that you have the id copied go back to your resource.lua file and put that ID into the string I talked about earlier. So now it should look like this [CODE]resource.AddWorkshop( "167161694" )[/CODE] Once you have your ID in the line of script save the document and put it in the following directory [B]garrysmod/garrysmod/lua/server/autorun[/B] Save the file, and upload to your server and restart! There you go! now downloading from the workshop! :rock: Source:[url]http://wiki.garrysmod.com/page/resource/AddWorkshop[/url]
Maybe put the tutorial to the wiki?
Thanks, this should help a lot of people.
I'm pretty sure the whole "step 2" is redundant an unnecessary to the point where if you don't know what that means specifying it is just going to confuse them more than an example would have. Also, I think something like this would be befitting of the wiki: [code] local maptable = { ["ttt_foundation_a1"] = 135894827, ["ttt_bb_suburbia_b3"] = 131586546, ["ttt_inception_ar01"] = 139863788, ["ttt_construction_v3"] = 148394206 } local map = game.GetMap() if maptable[map] then resource.AddWorkshop(maptable[map]) end[/code]
Sorry if this was confusing. I tried to make it as simple as possible.
Sorry, you need to Log In to post a reply to this thread.