Page 1 of 1
Best way to retrieve steamid / gametag?
Posted: Sat Aug 18, 2012 7:16 am
by Tuck
whats the fastest way to retrieve steamid from userid? and retrieve players gametag from steamid/userid ?
currently i would retrieve it this way;
Syntax: Select all
from Source import Player
for player in Player.Players():
if player.GetUserID() == userid:
steam_id = player.GetNetworkIDString()
tag = player.GetName()
Posted: Sat Aug 18, 2012 7:42 am
by Monday
Well if you had the player instance already you could use IVEngineServer.GetPlayerNetworkIDString()
Posted: Sat Aug 18, 2012 7:48 am
by Tuck
so looping true all the IPlayerInfo are the fastest way possible if only information i have is userid?

Posted: Sat Aug 18, 2012 8:06 am
by Monday
I believe so.. We may later add library methods that do the looping for you, but all that will provide is a little less work on your end.
Satoon has been messing with the player stuff much more than I have, so maybe he will chime in.
Posted: Sat Aug 18, 2012 8:26 am
by Tuck
Monday wrote:I believe so.. We may later add library methods that do the looping for you, but all that will provide is a little less work on your end.
Satoon has been messing with the player stuff much more than I have, so maybe he will chime in.
well looping is fine though, maybe it's just me but wouldnt a api that stores the IPlayerInfo in a dict where each key is a userid be even faster than having to loop?

Posted: Sat Aug 18, 2012 8:27 am
by Monday
I'm not sure about this... but I think this would work:
Syntax: Select all
myPlayer = Player.PlayerOfUserid(userid)
steamid = myPlayer.GetNetworkIDString()
tag = myPlayer.GetName()
Try it out?
Tuck wrote:well looping is fine though, maybe it's just me but wouldnt a api that stores the IPlayerInfo in a dict where each key is a userid be even faster than having to loop? :)
Not really.. the problem with that is it will slow down the plugin itself, because it has to do all that work regardless if you use the functionality or not.
Posted: Sat Aug 18, 2012 8:29 am
by Tuck
Monday wrote:I'm not sure about this... but I think this would work:
Syntax: Select all
myPlayer = Player.PlayerOfUserid(userid)
steamid = myPlayer.GetNetworkIDString()
tag = myPlayer.GetName()
Try it out?
Oh damn i feel stupid the PlayerOfUserid method (think i read about it yesterday) forgot all about that xD
Thanks a bunch :) was just what i was looking for :)
Posted: Sat Aug 18, 2012 8:57 am
by BackRaw
Tuck wrote:Oh damn i feel stupid the PlayerOfUserid method (think i read about it yesterday) forgot all about that xD
Thanks a bunch

was just what i was looking for
Don't feel stupid^^ feel..... surprised that this works
