GetPlayerCount: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Info|Function|Server & Client|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|Gets the count of the online players.}}
{{FuncDescription|Gets the count of the online players. On the client it only returns the number of streamed in players.}}


{{FuncSyntax|GetPlayerCount()}}
{{FuncSyntax|GetPlayerCount()}}
Line 11: Line 11:


== Example ==
== Example ==
<syntaxhighlight lang="Lua">
AddCommand("players", function(playerid)
AddCommand("players", function(playerid)
AddPlayerChat(playerid, "Players online: "..GetPlayerCount())
end)
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
* [[GetMaxPlayers]]
* [[GetMaxPlayers]]

Latest revision as of 22:57, 17 December 2019

GetPlayerCount

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Gets the count of the online players. On the client it only returns the number of streamed in players.

Syntax

GetPlayerCount()

Parameters

  • This function has no parameters.

Return Value

  • Count of players.

Example

AddCommand("players", function(playerid)
	AddPlayerChat(playerid, "Players online: "..GetPlayerCount())
end)

See also