In this article, we will be reviewing the process of forcing players to download workshop addons on your Garry's Mod server.
Step 1: Log into your Host Havoc game control panel (https://gamepanel.hosthavoc.com).
Step 2: View your game service.
Step 3: Open the File Manager.
Step 4: Navigate to the garrysmod/lua/autorun folder.
Step 5: If it does not already exist, create a folder in this directory named 'server'. Go into this directory.
Step 6: Create a new file named workshop.lua. Ensure this file is located in 'garrysmod/lua/autorun/server'.
Step 7: Open the file in the text editor (click the pencil icon next to the file).
Step 8: For every addon that you want the client to download, place the following: resource.AddWorkshop(workshopidhere). Replace 'workshopidhere' with the addon's workshop ID. This can be found at the end of the URL (numeric value).
Let's take a look at an example. We have the following 3 addons, all M9K weapon packs:
https://steamcommunity.com/sharedfiles/filedetails/?id=128089118
https://steamcommunity.com/sharedfiles/filedetails/?id=128093075
https://steamcommunity.com/sharedfiles/filedetails/?id=128091208
https://steamcommunity.com/sharedfiles/filedetails/?id=128093075
https://steamcommunity.com/sharedfiles/filedetails/?id=128091208
So, we have 3 IDs we will be working with; 128089118, 128093075 and 128091208.
We will want our workshop.lua file to look like:
We will want our workshop.lua file to look like:
resource.AddWorkshop("128089118")
resource.AddWorkshop("128093075")
resource.AddWorkshop("128091208")
Additionally, you can use a tool such as this one to help generate the needed code.
https://csite.io/tools/gmod-universal-workshop