NS2 Steamid to "real" Steamid
devicenull
Join Date: 2003-04-30 Member: 15967Members, NS2 Playtester, Squad Five Blue
NS2 outputs SteamID's in a weird format, it doesn't use the standard STEAM_0:x:y format, nor does it use the uint64 version of (which can be trivially converted back). What it does seem to give us is the m_unAccountId segment of the id. Happily, this can be <a href="http://hg.opensteamworks.org/open-steamworks/src/3761c6ead02e/Open%20Steamworks/CSteamID.h#cl-373" target="_blank">trivially converted</a> back to a normal steamid.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> steamid = int(ns2steamid)
if steamid % 2 == 0:
steamid = "STEAM_0:0:%i" % (steamid/2)
else:
steamid = "STEAM_0:1:%i" % (steamid/2)<!--c2--></div><!--ec2-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> steamid = int(ns2steamid)
if steamid % 2 == 0:
steamid = "STEAM_0:0:%i" % (steamid/2)
else:
steamid = "STEAM_0:1:%i" % (steamid/2)<!--c2--></div><!--ec2-->
Comments
Is there a reason that NS2 ouputs in this format?
Edit: Oops, I had the logic backwards, fixed now.
Slow-poke.
Huh, if that's the case then you really can't convert back to a normal steamid. That would suck.
prime real estate.
The ns2 wiki provide this information too : wiki.unknownworlds.com/ns2/Dedicated_Server#SteamID_Format
http://steamid.org/