Get CommunityID (SteamID64) String
I'd been wanting to find a function which retrieves a client's CommunityID but didn't find what I wanted from the original thread here. I also didn't want to have to resort to extensions/includes. The main problem (aside from 32-bit limits) was that most functions wouldn't work with newer SteamIDs so I've created a quick function for everyone here that will work with all individual SteamIDs.
I'm completely open to any optimizations here, so please write down any suggestions below. :) To use the function, create two strings, one that holds a client's SteamID (you can use GetClientAuthString for this too) and the other for the function's output. I've also made two directives to define the maximum lengths of SteamIDs and CommunityIDs. Usage: PHP Code:
PHP Code:
Code attributed to Zephyrus - untested, but may work: PHP Code:
|
Re: Get CommunityID (SteamID64) String
Thanks :D
|
Re: Get CommunityID (SteamID64) String
Quote:
I'll reserve this space to describe the process of getting the SteamID64 if requested. |
Re: Get CommunityID (SteamID64) String
Doing all the strcmp checks is expensive, just check ExplodeString's return value.
|
Re: Get CommunityID (SteamID64) String
Quote:
|
Re: Get CommunityID (SteamID64) String
Quote:
(Format makes it go thorugh all the trouble of checking for format class functions, such as %s, %d, etc), and since you have none, strcopy would be faster in this case. |
Re: Get CommunityID (SteamID64) String
Quote:
|
Re: Get CommunityID (SteamID64) String
I went to use this for a CS:GO plugin, except realized that the Community ID's returned weren't quite right. After doing a little research, I discovered that your stock is returning nothing but "76561197960265728" which is the identifier (and the stock is missing this part of the equation: accountID * 2).
I tried manually having the SteamID's inputted, as well as get them from GetClientAuthString. Code:
new String:sAuth[32] = "STEAM_0:0:14297752"; Code:
L 08/06/2012 - 18:25:00: [test.smx] SteamID to CommunityID: STEAM_0:0:14297752 -> 76561197960265728 |
Re: Get CommunityID (SteamID64) String
It's just the mathematics of the function since it has to work with strings. Change new String:sComm[32] to [18] and you'll be fine.
When using [18], I get: STEAM_0:0:14297752 -> 76561197988861232 All Steam64IDs are 17 characters long, so an array of 18 always works, but when I have time I'll add something so that 0s are prefixed if someone needs to use a longer array. |
Re: Get CommunityID (SteamID64) String
Ah, and of course I changed that in my plugin while I was waiting for a reply...didn't expect that to be the problem but makes sense now! Thanks!
|
All times are GMT -4. The time now is 09:30. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.