GetPlayerCount: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
This function returns the number of players currently connected to the server. | This function returns the number of players currently connected to the server. | ||
{{Note|#getElementsByType("player") works the same as this function but also works client side unlike this function.}} | |||
Note | |||
==Syntax== | ==Syntax== |
Revision as of 18:54, 23 January 2012
This function returns the number of players currently connected to the server.
Syntax
int getPlayerCount ( )
Returns
Returns the number of players connected to the server as an int.
Example
This example displays a chat message with the number of players connected to the server when a player joins or quits.
function playerCount ( ) outputChatBox ( "There are now " .. getPlayerCount() .. " players on this server!" ) end addEventHandler ( "onPlayerJoin", getRootElement(), playerCount ) addEventHandler ( "onPlayerQuit", getRootElement(), playerCount )
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState