Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Returns an array of players objects for living players. |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var living = Players.alive; // array of living players objects |
Return value
An array of living Players Objects, including Scavengers (if applicable), excluding spectators and vacant slots.
Notes
The indexes in the array are sequential and not based on player IDs.
Uses caching to boost performance. The cache is automatically invalidated every game tick. See Cache API for details.
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Players.alive.forEach(function(player) { // player = players object for current living player // player.id = id of living player }); |
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
// .isAlive filters out spectators and vacant slots var isLiving = Players[playerID].isAlive; |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Players APITopics:
|