Custom Loading Screen - Player Data

Hey Facepunch,

I am looking for some support with a loading screen.
I am trying to get player data to display on the loading screen, but to be honest, I have no idea where to start.
I have limited knowledge of LUA, decent knowledge of HTML and basic knowledge of php. I can also work with MySQL but the server doesn’t have a database as of yet.

This is what I mean, where it says the steam name.
Any help is much appreciated.

Thanks all,
Rapid.

Loading screens are purely non-lua.

You need to get a Steam API key and query the Steam API for all the player information when the player loads the page. This should be done in PHP. You’ll need to set your sv_loadingurl to “http://yoursite.com/loadingscreen.php?steamid=%s&map=%m”. You can retrieve the steamid from the $GET array with the index of “steamid”. The API will return a JSON or XML string with all the information you need. Here’s Valve’s documentation: https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries.28v0002.29

Thanks for your help. Could you give an example of using steamid as an index?

[editline]18th October 2015[/editline]

Whenever I use that, I just get some numbers -_-.

Thanks.

that steamID has to be converted, duh.

[editline]18th October 2015[/editline]

heres the example from metroload:



$userID = $_GET["steamid"];

$steamId1  = substr($communityId, -1) % 2;
$steamId2a = intval(substr($communityId, 0, 4)) - 7656;
$steamId2b = substr($communityId, 4) - 1197960265728;
$steamId2b = $steamId2b - $steamId1;


Just roughly ripped out of the function, but you should see what to do.

You would do



$steamid = $_GET['steamid'];


$steamid will now be the 64-bit steamid passed by gmod. You need to request the proper steam API page with file_get_contents and pass $steamid in to the url to get the player’s information. Please note that the API needs a 64-bit steamID, not the 32-bit version.

Thanks :wink:

[editline]18th October 2015[/editline]

Thanks :wink: