GetPlayers

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This returns the number of players currently playing on the server. (This function also has an alias GetPlayerCount)

Syntax

  1. int GetPlayers()

Arguments

  • None

Example

This command will return the number of players in-game when someone types /players'.

  1.  
  2. function onPlayerCommand( plr, cmd, text )
  3. {
  4. if ( cmd == "players" )
  5. {
  6. Message( "There are currently " + GetPlayers() + " players in-game.", lpr );
  7. }
  8. return 1;
  9. }
  10.  

Notes

The function MessagePlayer and call onPlayerCommand were used in this example. More info about them can be found in corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox