Es getuserid

From EventScripts Community Encyclopedia


Overview

Syntax: es_getuserid <variable> [match-text]

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: es_xgetuserid

Description

Searches all online users to see if their STEAMID, userid, handle, or name matches the match-text. It stores the userid in variable-- a 0 return indicates no match was found.


Parameters

  • variable - a variable where you wish to store the
  • match-text - optional parameter providing the text you'd like to search for in the player's name. Also accepts full STEAMIDs and userids. If this parameter isn't provided, es_getuserid returns a valid userid of one of the connected player's. This userid IS NOT RANDOM.


Examples

// find a player so you can give them a single player_weaponstrip everyone can use
es_setinfo myplayer 0
es_getuserid myplayer
es_give server_var(myplayer) player_weaponstrip
 
// find any player using 'mattie' in their name
es_setinfo mattieplayer 0
es_getuserid myplayer "mattie"
if (server_var(myplayer) > 0) then kickid event_var(myplayer) "Reserved name: mattie"


Notes

  • This command will search for match-text in this order:
    • exact userid
    • exact handle
    • exact STEAMID
    • substring within a name
  • This command behaves similarly to Mani commands which accept a partial name. (In fact, the code was long ago borrowed from Mani.)


See also

  • getrandplayer - Use this command to get random userid per filter
blog comments powered by Disqus