Garry's Mod Wiki

Workshop for Dedicated Servers

Dedicated servers can install addons straight from workshop collections, but it requires an addition to the startup parameter.

The server will download the collection at startup and mount all the downloaded addons.

If your server is running a map that is also in the server's collection (by .bsp name), the map will be automatically marked for download by clients, just like resource.AddWorkshop does. When this happens, server console will contain a message saying Making workshop map available for client download.

Similar thing happens with the server's gamemode. If the current gamemode has set a workshopID in its <gamemode name>.txt, that ID will be marked for download by clients upon joining the server. When this happens, the following message is printed to console at server startup: Making workshop gamemode available for client download.

See Serving Content for more information on serving content to players.

Create collection

First of all create a collection and find your collection ID. Do note that your collection needs to be public or unlisted, else, srcds won't be able to access it!

Applying the command-line parameter

Append the following parameter to the server startup command-line:

+host_workshop_collection WORKSHOPID

An example could be:

+host_workshop_collection 123456789

Auto updates

You can disable Workshop content auto updates on server start up via the host_workshop_autoupdate console variable. Setting it to 0 will prevent automatic updates.

This is useful against cases where addons might be updated to contain malicious or otherwise unwanted changes.

Keep in mind that disabling automatic updates could lead to other unwanted consequences, such as map updates preventing players from joining your server (since your server would be running older version of the map) and issues like that with content updates.

Example

The example below starts a dedicated server with 20 player slots. It downloads or updates all of the addons in collection 157384458. This collection includes the Zombie Survival gamemode and a few maps. It sets the gamemode to zombiesurvival and loads one of the downloaded maps.

srcds.exe +maxplayers 20 -console +host_workshop_collection 157384458 +gamemode zombiesurvival +map zs_cleanoffice_v2

Every time you restart your server it will check that these addons are all up to date.

Still Confused?

View this short tutorial to see how it is set up.

https://www.youtube.com/watch?v=saCof9QqjnA