From GMod Wiki
| Go to:|
|Description:||The page players will see when joining your server and downloading resources.|
Setting up a sv_loadingurl page
To setup sv_loadingurl all you need is a web server to host the page on. Once you have uploaded your page just run sv_loadingurl "http://mywebsite.com/loadingurl" or whatever the directory name (or php file) is.
- Called when a file starts downloading (based on the status text in the grey loading box)
- The parameter is the name of the file (as printed in the status text in the grey loading box)
- Called when a status other than downloading appears in the grey loading box
- The parameter is the status text (as printed in the status text in the grey loading box)
- Called when the number of files left to download changes
- The parameter is the number of files remaining to be downloaded (including the currently downloading file)
- Called at the same time as SetFilesNeeded
- The parameter is the total number of files to be downloaded during this connect attempt
Using PHP with Loading URL
If you run sv_loadingurl "http://mywebsite.com/loadingpage.php?steamid=%s&mapname=%m" then the following $_GET values are available to PHP.
- $_GET["steamid"] is the player's steam community id.
- $_GET["mapname"] is the current map name. EX: gm_construct
Example code for a simple loading page.
<?php //Get the steamid (really the community id) $communityid = $_GET["steamid"]; //Get the map name $mapname = $_GET["mapname"]; //See if the second number in the steamid (the auth server) is 0 or 1. Odd is 1, even is 0 $authserver = bcsub($communityid, '76561197960265728') & 1; //Get the third number of the steamid $authid = (bcsub($communityid, '76561197960265728')-$authserver)/2; //Concatenate the STEAM_ prefix and the first number, which is always 0, as well as colons with the other two numbers $steamid = "STEAM_0:$authserver:$authid"; //Output welcome line echo "Welcome to my server!<br>"; //Output Steam Community ID echo "Your Community ID is $communityid<br>"; //Output calculated SteamID echo "Your SteamID is $steamid<br>"; //Output current map echo "The current map is $mapname<br>"; //Output friendly greeting echo "Enjoy your stay!"; ?>
This will output something similar to
Welcome to my server! Your CommunityID is 76561197962734862 Your SteamID is STEAM_0:0:1234567 The current map is gm_construct Enjoy your stay!
Extra Information: "sv_loadingurl" does not work just inside of server.cfg, it needs to be in the command line and autoexec.cfg to work properly