Squirrel/Server/Functions/Server/GetPlayers

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This returns the number of players currently playing on the server. == Syntax == <code>string GetPlayers()</code> == Arguments == *'''None''' == Example == This command wil...)

Revision as of 02:59, 7 January 2010

This returns the number of players currently playing on the server.

Syntax

  1. string GetPlayers()

Arguments

  • None

Example

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

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

Notes

The function MessagePlayer and call OnPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Template:Squirrel/Functions/Server

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox