Es.getplayername

From EventScripts Community Encyclopedia



Method: getplayername

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

Method Overview

Table of Contents

Contents


Description

Stores the user's name in the variable specified.
This is the Python equivalent of: http://www.eventscripts.com/pages/es_getplayername

Arguments

  • userid - The user id of the player you're getting the name of


Examples

import es
def load():
        es.regsaycmd('!name', 'script/name')
def name():
        user = es.getcmduserid()
        name = es.getplayername(user)
        es.msg('Your name is', name)

When the player says !name it will run the function 'name', find their userid store it in a variable, get their name and store it in a variable and print "Your name is <name> " in the chatbox.

Notes

It is recommended that you use es.exists() to check if the userid does in fact exist
The server could crash if the provided userid does not exists!
variable will equal 0 if the player does not exist.

See Also

blog comments powered by Disqus