Arma 3 Scripting

Command in Multiplayer, Object Detection

allPlayers

Also available as Markdown and JSON, or read the original wiki page.

Description

Returns a list of all units controlled by connected clients. This includes:

Use BIS_fnc_listPlayers or see #Example 1 to only get human players.

Syntax

allPlayers

Returns: Array of Objects

Examples

Example 1

Get human players (i.e. all players excluding Headless Clients):

private _players = allPlayers - entities "HeadlessClient_F";

Example 2

Get non-virtual players (i.e. all players excluding Virtual Entities):

private _players = allPlayers select {!(_x isKindOf "VirtualMan_F")};

Example 3

{
    systemChat format [
        "Player %1 is %2", 
        name _x, 
        ["dead", "alive"] select alive _x
    ];
} forEach allPlayers;

Example 4

private _bluforPlayers = blufor countSide allPlayers;

Multiplayer

See also

allCurators · allGroups · allDead · allUnits · switchableUnits · playableUnits · vehicles · allUnitsUAV · allDeadMen · isPlayer · playersNumber · allUsers · getUserInfo