GetPlayerCount

Category: Player
Since engine version: 4.6.5.0 CP (extended in 4.9.6.0 CR)

Description

Returns the number of players currently in the game.

Syntax

int GetPlayerCount (int ePlayerType);

Parameter

ePlayerType:
[opt] If specified, only the number of players of the specified type is returned. For a list of all player types see GetPlayerType.

Remark

As players may join and leave a game at runtime, there can be "gaps" in player indexing, meaning player numbers may skip certain values. GetPlayerCount returns the actual number of players, not the index of the last player plus one. To process all joined players you need special handling (see example) - you cannot simply run from index 0 to GetPlayerCount() - 1. See the example for GetPlayerByIndex.

Example

See GetPlayerByIndex.
See also: EliminatePlayer, GetPlayerByIndex, GetPlayerName
Sven2, Dezember 2007