Es.getuserid

From EventScripts Community Encyclopedia



Method: getuserid

Module: es
Class: (no class)
EventScripts version: 2.0

Method Overview

Table of Contents

Contents


Description

Searches all online users to see if their STEAMID, userid, or name matches the match-text. This is the Python equivalent of: http://www.eventscripts.com/pages/es_getuserid

Arguments

  • variable - a variable where you wish to store the userid
  • match-text - the text you'd like to search for in the player's name. Also accepts full STEAMIDs and userids.


Examples

import es
 
def load():
  # Check to see if the say command exists first
  if not es.exists('saycommand', 'find'):
    # If it doesn't, register the 'find' say command to the 'findplayer' block
    es.regsaycmd('find','scriptname/findplayer')
 
def findplayer():
  # Get the userid of the player that ran the find command
  userid = es.getcmduserid()
  # Get the player name/partial name they provided
  player = es.getargv(1)
  # Check using es.getuserid() to see if this user exists
  # This is the same as doing es.getuserid(player_userid,player)
  player_userid = es.getuserid(player)
  # If it does.....
  if player_userid:
    # Then get the players name
    player_name = es.getplayername(player_userid)
    # And tell the player that ran the command what the players full name and userid is
    es.tell(userid,'Found player',player_name,'with userid',player_userid)
  # Otherwise...
  else:
    # Tell the player that es.getuserid() couldn't find any userid from that name
    es.tell(userid,'Could not find player.')

Notes

  • This command will search for match-text in this order:
    • exact userid
    • 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

blog comments powered by Disqus