You can use the following snippet to get a users SteamID, it also contains the line to convert from Hex to Dec
-- Get a players SteamID
function GetSteamId(source)
local steamHex = nil
local identifiers = GetPlayerIdentifiers(source)
for _, identifier in next, identifiers do
if string.find(identifier, "steam:") then
steamHex = identifier
break
end
end
if not steamHex then
return false, 0
end
if not string.find(steamHex, "steam:") then
return false, 0
end
local steamId = tonumber(string.gsub(steamHex,"steam:", ""),16)
if not steamId then
return false, 0
end
return true, steamId
end
-- Usage:
local hasSteam, steamId = GetSteamId(source)
if hasSteam then
-- Do stuff with their steamId
end
The output steamId value in this case would be 76561197971687587 based on your steam:110000100ae48a3 example
Edit: Function now actually iterates over all of the identifiers to find the Steam identifier
2 Likes