Getrandplayer

From EventScripts Community Encyclopedia


Overview

Syntax: getrandplayer <variable> <identifier>

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: <none>

Description

Stores a random userid in variable based on the identifier you specify. You can also use it with an es before it to expand variables.

Parameters

  • variable - a variable where you wish to store the userid
  • identifier - the target player/group/sort of players
    • #all - all players
    • #ct - counter-terrorists
    • #t - terrorists
    • #spec - spectators
    • #un - unassigned (people who never joined a team or spec after connecting)
    • #dead - dead players
    • #alive - living players
    • #human - real players
    • #bot - bots


Examples

es_load corelib
es_xsetinfo myvar 0
// make a random bot and human player say something
getrandplayer myvar #bot
es_sexec server_var(myvar) say I am a silly bot! 
getrandplayer myvar #human 
es_sexec server_var(myvar) say I am a real player!


Notes

  • The variable you defined with variable will be set to a random userid. You can access it with server_var(variable)
  • Command Added to corelib V0.81 and distributed with Eventscripts V1.2.1+
  • Requires corelib to be loaded.


See also

blog comments powered by Disqus