GetPlayerCount: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetPlayerCount()}} {{FuncParameters}} {{FuncNoParam}} {{FuncReturnValue|__EDIT_ME__}} == Example..." |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server & Client|1.0}} | ||
{{FuncDescription| | {{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 8: | Line 8: | ||
{{FuncNoParam}} | {{FuncNoParam}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Count of players.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
AddCommand("players", function(playerid) | |||
AddPlayerChat(playerid, "Players online: "..GetPlayerCount()) | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
* [[GetMaxPlayers]] |
Latest revision as of 22:57, 17 December 2019
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)