featurelist.orgfeaturelist.org
 
U
D
6 points - posted 3299 days ago by Jeff - status: Active - 2 comments watch embed this
userid = es.getuserid(<entity index>) #if index belongs to a player return that player's userid other wise return 0

This would help me a bit I know :) (I was looking through the TF2 events and a few of them just return the index of the player instead of userid)

~J3ff

SuperDave posted on 2008-09-18 17:45:58
That would be hard to differentiate between an userid and an index, but I suppose it's possible.
def findUseridByIndex(index):
index = int(index)
playerlist = es.createplayerlist()
for userid in playerlist:
if playerlist[userid]['index'] == index:
return userid
return es.getuserid(index)

Sorry, this removed the formatting but I think you get the idea.

Omega_K2 posted on 2009-06-05 23:41:21
I support this idea because you'll need the player index in many cases and I think an command direclty coded into ES will be fasted then the method SuperDave posted.
To find out whether a index id is given a special identifier could be used (would look like es.getuserid('#5')).