Raised This Month: $ Target: $400
 0% 

A reliable get steam id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kiceqs
Junior Member
Join Date: Jun 2015
Old 05-22-2019 , 08:05   A reliable get steam id
Reply With Quote #1

Since I have a server in mainland China, however, I found that GetSteamAccountID cannot guarantee always return users' steam account id (it will return 0).

I have tried to set validate to false; it looks like in 64 players, there will be around 3 players' steamid cannot be retrieved.

Will it be something about perfectworld or just I need to use another way to get steamid.

I think I may try to use GetClientAuthString as a fallback?
kiceqs is offline
CrazyHackGUT
AlliedModders Donor
Join Date: Feb 2016
Location: Izhevsk, Russia
Old 05-22-2019 , 09:07   Re: A reliable get steam id
Reply With Quote #2

GetSteamAccountID() returns zero when server doesn't authorize client. For example, when server connection is Steam is unstable. In this moments, GetCluentAuthString() will also doesn't return SteamID (note: GetClientAuthString() and GetClientAuthId() also returns boolean), and just writes "magic" sourcemod string STEAM_ID_STOP_IGNORING_RETVALS.
__________________
My english is very bad. I am live in Russia. Learning english language - very hard task for me...
CrazyHackGUT is offline
Send a message via ICQ to CrazyHackGUT Send a message via Skype™ to CrazyHackGUT
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 05-22-2019 , 17:40   Re: A reliable get steam id
Reply With Quote #3

GetClientAuthId provides them all in a reliable way.

Simply follow up on what CrazyHackGUT said, just check the return value:

PHP Code:
    if (GetClientAuthId(clientAuthId_SteamID64steamID64sizeof(steamID64))) {
        
/* Do whatever you want with the steamID64 from the SteamID64 variable */
    
} else {
        
/* Do something else, when the current steam ID isn't valid (e.g. Steam authentication
            problems). Perhaps halt here, and create a timer that will re-check later, such as
            for example every 20-30 seconds, and continue until GetClientAuthId returns true? */
    

You know when it returns false that it does not have a proper Steam ID that is verified with the Steam backend....

Following the API and checking the return values properly, means that you have a reliable way.

Being lazy (and most of all: a lousy developer), and not following the documentation properly, ... literally means that it will get as reliable as the developer wants it.


If you need the proper ID (... in a realible way), do the above and decide in the ELSE part;

a) Simply halt the procedures and re-check later using a timer before continuing.

b) Simply kick then client due to failure to validate Steam ID, asking him/her to try re-connecting.


a) Could eventually be made together with something limiting a player's functionality, or forcing them to stay on the spectator team, etc...
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode