1. Scaricalo
Su Linux, il server ha bisogno prima delle librerie a 32 bit:
dpkg --add-architecture i386
apt update
apt install -y lib32gcc-s1 lib32stdc++6
# Windows
C:\steamcmd\steamcmd.exe +force_install_dir C:\gmod +login anonymous +app_update 4020 validate +quit
# Linux (con l'utente steam)
~/steamcmd/steamcmd.sh +force_install_dir ~/gmod +login anonymous +app_update 4020 validate +quit
2. Il token di Steam (GSLT)
Su steamcommunity.com/dev/managegameservers crea un token con l'App ID 4000. È quello del gioco, non quello del server (4020): con il 4020 non funziona.
3. Avvialo
# Windows
C:\gmod\srcds.exe -console -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 16 +sv_setsteamaccount IL_TUO_TOKEN
# Linux
~/gmod/srcds_run -game garrysmod +gamemode sandbox +map gm_construct +maxplayers 16 +sv_setsteamaccount IL_TUO_TOKEN
Sostituisci sandbox con la modalità che vuoi: terrortown (TTT, è inclusa) o quella che hai scaricato, come DarkRP.
4. Raccolte del Workshop
Crea una raccolta nel Workshop di Steam con le tue mappe e i tuoi addon, e aggiungi alla riga di avvio:
+host_workshop_collection ID_DELLA_RACCOLTA
Il server scarica e monta tutto il contenuto della raccolta all'avvio.
5. Nome, password e RCON
In garrysmod/cfg/server.cfg:
hostname "Il mio server Garry's Mod"
sv_password ""
rcon_password "UNA_PASSWORD_LUNGA"
6. Porte
Garry's Mod usa la 27015 in UDP per il gioco e in TCP per RCON:
# Windows (PowerShell come amministratore)
New-NetFirewallRule -DisplayName "GMod UDP 27015" -Direction Inbound -Protocol UDP -LocalPort 27015 -Action Allow -Profile Any
New-NetFirewallRule -DisplayName "GMod TCP 27015" -Direction Inbound -Protocol TCP -LocalPort 27015 -Action Allow -Profile Any
# Linux
ufw allow 27015/udp
ufw allow 27015/tcp
Per entrare: console del gioco (tasto \ o ~) e connect IL_TUO_IP:27015.