allPlayers: Difference between revisions
Lou Montana (talk | contribs)  (Fix description)  | 
				Lou Montana (talk | contribs)  m (Fix example)  | 
				||
| Line 19: | Line 19: | ||
| [[Array]] of [[Object]] |RETURNVALUE=    | | [[Array]] of [[Object]] |RETURNVALUE=    | ||
|x1= Get only human players:<code>[[private]] _headlessClients = [[entities]] "HeadlessClient_F";  | |x1= Get only human players:  | ||
[[private]] _humanPlayers = [[allPlayers]] -   | <code>[[private]] _headlessClients = [[entities]] "HeadlessClient_F";  | ||
[[private]] _humanPlayers = [[allPlayers]] - _headlessClients;</code> |EXAMPLE1=  | |||
|x2= <code>{  | |x2= <code>{  | ||
Revision as of 13:15, 27 April 2020
Description
- Description:
 - Returns a list of all units controlled by connected clients - human players including dead players, but also Headless Clients.
Use BIS_fnc_listPlayers or see Example 1 to get human players only. - Multiplayer:
 - * In a player-hosted game, the complete array of allPlayers may get delayed on mission start. Use BIS_fnc_listPlayers if you need it earlier.
- The order of players in the return array may differ from server to clients.
 
 - Groups:
 - Uncategorised
 
Syntax
- Syntax:
 - allPlayers
 - Return Value:
 - Array of Object
 
Examples
- Example 1:
 - Get only human players:
private _headlessClients = entities "HeadlessClient_F"; private _humanPlayers = allPlayers - _headlessClients; - Example 2:
 { systemChat format [ "Player %1 is %2", name _x, ["dead", "alive"] select alive _x ]; } forEach allPlayers;- Example 3:
 private _bluNums = west countSide allPlayers;
Additional Information
- See also:
 - allCuratorsallGroupsallDeadallUnitsswitchableUnitsplayableUnitsvehiclesallUnitsUAVallDeadMenisPlayerplayersNumber
 
Notes
- 
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note