While players join your server, Garry's Mod shows a loading screen. Instead of the default loading screen you can display your own web page, for example with your server logo, your rules or a progress bar. You do this with the ConVar sv_loadingurl.
Create the Loading Screen Page
If you do not want to code your own web page, you can use a free generator. The Garry's Mod wiki lists the following options:
| Option | Description |
|---|---|
| gmod-lsm.com | Free online loading screen editor, no coding and no web server of your own required |
| gmodload.com | Free loading screen creator with no coding and no web server of your own |
| Load Seed | Template on GitHub for developing your own loading screen |
Either way, in the end you need the full address of your loading screen, for example https://example.com/loading/.
Enter the Loading Screen in autoexec.cfg
The Garry's Mod wiki names the file autoexec.cfg as the place for sv_loadingurl. The server.cfg of your server already contains an empty sv_loadingurl "" line and is executed after autoexec.cfg. That is why you remove this line first, otherwise it would overwrite your address with an empty value.
-
Stop the server
Stop your server via the dashboard. -
Connect via SFTP
Connect to your server via SFTP. -
Remove the empty line from server.cfg
Open the following file:/garrysmod/cfg/server.cfgDelete the line
sv_loadingurl ""there and save the file. -
Enter the address in autoexec.cfg
Open the following file. Create it if it does not exist yet:/garrysmod/cfg/autoexec.cfgEnter the address of your loading screen there:
sv_loadingurl "https://example.com/loading/" -
Start the server
Save the file and start your server.
Pass Player Data to the Page
You can use two placeholders in the address, which Garry's Mod replaces automatically when a player connects:
| Placeholder | Replaced with |
|---|---|
%s |
The 64-bit SteamID (SteamID64) of the connecting player |
%m |
The name of the current map |
Your web page can read these values as URL parameters, for example to show the current map or recognise players by their SteamID.
Show Loading Progress with JavaScript
While loading, Garry's Mod calls JavaScript functions on your page. You can use them, for example, to show the current status or the download progress. You only need this section if you code the page yourself.
| Function | Called |
|---|---|
GameDetails(servername, serverurl, mapname, maxplayers, steamid, gamemode, volume, language) |
At the start, with information about the server and the player |
SetFilesTotal(total) |
At the start, with the total number of files to download |
DownloadingFile(fileName) |
When the player starts downloading a file |
SetStatusChanged(status) |
When the connection status changes, e.g. "Starting Lua..." |
SetFilesNeeded(needed) |
When the number of files still needed changes |
The functions must be attached to the window object of your page:
window.SetStatusChanged = function(status) {
document.getElementById("status").textContent = status;
};
Test the Loading Screen
-
Join the server
Connect to your server as described in How to Join Your Garry's Mod Server. -
Check the loading screen
Your own page should now be shown while you connect. -
Reconnect after changes
If you changed something on the page or the address, disconnect and connect again to see the result. Changes toautoexec.cfgonly take effect after a server restart.
