Squirrel/Server/Functions/Server/GetPlayers
From Liberty Unleashed Wiki
(Difference between revisions)
Line 26: | Line 26: | ||
=== Notes === | === Notes === | ||
− | The function [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Events/Player/onPlayerCommand|onPlayerCommand]] were used in in this example. More info about them in corresponding pages. | + | The function [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in in this example. More info about them in corresponding pages. |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Functions/Server}} | {{Squirrel/Functions/Server}} |
Revision as of 11:10, 11 October 2010
This returns the number of players currently playing on the server.
Syntax
string GetPlayers()
Arguments
- None
Example
This command will return the number of players in the server when someone types /players'.
function onPlayerCommand( id, cmd, text ) { if ( cmd == "players" ) { Message( "There are currently " + GetPlayers() + " players in-game.", id ); } }
Notes
The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.