Es getplayercount

From EventScripts Community Encyclopedia


Overview

Syntax: es_getplayercount <variable> [team number]

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_xgetplayercount

Description

Stores the count of players on the server into a variable. Optionally, a team can be specified and the count of that team will be returned.

Parameters

  • variable - name of the variable you want to save the player count.
  • team number - optional parameter to specify which team you want. 2 - Terrorists, 3 - Counter Terrorists


Examples

// Get the total number of players and store in the variable "allplayers"
es_getplayercount allplayers
// Get the total number of Terrorists and store in the variable "allterrorists"
es_getplayercount allterrorists 2


Notes

  • This function returns -1 if an error occurs (e.g. you specify a non-existent team index).
  • Counts bots as players.


See also

blog comments powered by Disqus