Document Updated ago
If this documentation has helped you, don't hesitate to send me a private message. Your enthusiast makes me happy to see.
Regards,
Contents :
- HOW TO CREATE AND PUBLISH AN ADDON ON THE WORKSHOP?
1.1 What's an addon on the workshop, what's it for?
1.2 How to create the GMA file to upload?
1.3 Publish the addon on the workshop
1.4 How to find the addon ID on the workshop?
1.5 How to force the upload of addons to your server?
1.6 Publish an addon update on the workshop - HOW TO CREATE AND ADD A COLLECTION TO A GARRY'S MOD SERVER?
2.1 What is a collection on the workshop, what is it for?
2.2 Create a collection of addons for Garry's Mod
2.3 How to find the collection identifier on the workshop?
2.4 How to add a workshop collection to your Gmod server?
HOW TO CREATE AND PUBLISH AN ADDON ON THE WORKSHOP?
1.1 What's an addon on the workshop, what's it for?
When you upload models, materials, maps on your server, the content is only for your server, if a player joins your server and he is missing his resources, he won't get the sounds, textures problems (Pink and Black), red MODEL ERRORS, in short, all that means he is missing something on his hard drive.
To solve this, he will need to have the contents of installed on his computer, for this you can put its contents in an addon to share its elements easily.
There are several methods of sharing, via the Lua file described in this documentation below. The user can also "Subscribe" on the addon page. Or include it in a collection I also took the care to explain below.
1.2 How to create the GMA file to upload?
We assume that your addon is already working, if you are new here is the structure of the folder already explained here : File structure
In this explanation we're going to call the addon : gmodaddon.gma
Before you can publish your addon you will have to compress your folder into GMA, because it is this GMA file that you will upload, so our first goal is to get the famous gmodaddon.gma. To do this you will have to do it via your command prompt and so doing everything step by step is a piece of cake there are only three commands. The first to go to a folder, the second to compress (create your GMA), the third to upload.
Before typing the commands to turn your folder into gmodaddon.gma you'll have to put one thing at the root of your addon folder :
A text file that you will name addon.json, I use :
{
"title" : "gmodaddon",
"type" : "ServerContent",
"tags" : [],
"ignore" :
[]
}
It's the bare minimum to function. The content of the addon.json file will be editable from the addon page on steam.
So we can start with the commands :
- To open the command prompt: Press Windows+R and type cmd in the Run window.
- You will need to go to the bin folder of your gmod installation where gmad.exe is located and enter the command :
cd /Program Files (x86)/Steam/steamapps/common/GarrysMod/bin
In this example my addon folder is on my desktop:
And we're going to run gmad.exe and point to the folder gmodaddon to compress it to .gmagmad.exe create -folder C:Users/user/Desktop/gmodaddon
Now you have your gmodaddon.gma. After a little processing time you will get a confirmation that your gma has been created and will find your gmodaddon.gma in the same folder where your addon folder was. If you have this gma under the elbow to publish it you can go to the next step.
Beware it doesn't work if you forget to put the addon.json file inside.
1.3 Publish the addon on the workshop
You need an image for your addon on the workshop:
The image for the workshop in jpg format and with dimensions of 512x512 we will name it addon_image.jpg in this example.
So you have at hand your gmodaddon.gma (your addons) and your image.
So you are still in the bin folder of your gmod installation where gmad.exe was, but this time you will run gmpublish.exe to upload your gmodaddon.gma file:
gmpublish.exe create -icon C:Users/user/Desktop/addon_image.jpg -addon C:Users/user/Desktop/gmodaddon.gma
You will then see the percentage of the progress ending with a : Success!
Now you'll just have to go to your profile page to see your addon online.
Shortcut link : Your workshop showcase
1.4 How to find the addon ID on the workshop?
Once your addons online you can find the id at the end of the URL of the addon page for example for my content package for Zworld, it's 109691377 : https://steamcommunity.com/sharedfiles/filedetails/109691377
1.5 How to force the upload of addons to your server?
To start you will create a file in the autorun folder of your server called workshop_addons.lua, path :
garrysmod/garrysmod/lua/autorun/server/workshop_addons.lua
Open the file with any text editor and you will insert this line : resource.AddWorkshop( "Workshop_Addon_ID" )
Example :
resource.AddWorkshop("109691377") -- Content ressource of Zworld
resource.AddWorkshop("109691377") -- Map
Use -- to comment in lua file :
-- Map
Duplicate this line by changing the ID for each addon that you want to force the user to download when logging in.
1.6 Publish an addon update on the workshop
You may have added textures and templates in your package so don't forget to update your addon on the workshop to share the content with your users. Re-create the updated gma file (explained above) that you will upload except that this time the command to update an existing product will ask you to insert your workshop id (also explained above). In my example the number of my addon is: "109691377".
gmpublish update -addon "C:/Users/PCFIX/Desktop/gmodaddon.gma" -id "109691377" -changes "Add Content"
TerminΓ©.
2. HOW TO CREATE AND ADD A COLLECTION TO A GARRY'S MOD SERVER?
2.1 What is a collection on the workshop, what is it for?
A collection is a collection of addons that makes up the content of your server, so your users will be able to download all the content at once without searching every link in each addon. They will only have to click subscribe to everything to subscribe to each addon in the collection. Useful and efficient.
Before adding a workshop collection to your server, you must first create a collection on Steam.
You will also be able to associate a collection to your server, i.e. the user will download the entire content before being able to join, which will prevent them from disconnecting due to texture and model errors.
2.2 Create a collection of addons for Garry's Mod
This link is a shortcut to create your collection: https://steamcommunity.com/workshop/browse/?appid=4000§ion=collections
You can see the collections created by other users with the create your collection button in blue on the right :
2.4 How to add a workshop collection to your Gmod server?
Include this variable in the command line to launch your server +host_workshop_collection COLLECTION_ID
COLLECTION_ID is the id of your collection.
What gives for my collection for example:
+host_workshop_collection 108212613
How install an addon on Gmod ?
How to test an addon without uninstalling everything?
Backup problem in the data folder on Gmod server
How to replace Awesomium by Chromium on Gmod?
Sounds Formats supported on Gmod
Code minification (Optimisation)
Publish an addon on the Gmod workshop
Description of the Activation System - DRM
How to activate a Script on Gmod protected by a DRM ?
Write an review on a Gmod addon
Get technical support
How to test a Gmod addon before buying it?
Text formatting language
Website ranks - Originahl Scripts
Presentation of the workspace
How avoid the Leak of your scripts