Retrieving connecting players UniqueID

THIS IS FOR LOADING SCREEN!

Ok, so i’m trying to displayclients who are joining’s undefined pointshop points number. I have the code working, but i need to calculate the client’s UniqueID as thats what it needs to query in the mysql database… how can i calculate that for the client joining? Theres a way to calculate their steam id of course, so there should be a way to calculate unique id.

Lua:


local uniqueid = util.CRC("gm_" .. ply:SteamID() .. "_gm")

PHP equivalent:


$uniqueid = sprintf("%u", crc32("gm_" . $steamid . "_gm"));

Would i have to edit the URL for the sv_loadingurl ?

From the Garry’s Mod loading page example:

SteamID ( In the form of community id ) and Mapname are passed automatically, but steamid can be calculated. So after $steamid is where you could use his code to assign it to a variable, then do your query.


<?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";
?>

Ok but what would i put in the url for my sv_loading “” like for steamid you would put “?steamid=%s”

Ah, yeah you’re right; it does need to be defined :slight_smile: :

sv_loadingurl “http://www.example.com/loadingpage.php?steamid=%s&mapname=%m

You can find a list of loading url functions here