allPlayers: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <dl class="command_description"> </dl>" to "") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 1: | Line 1: | ||
{{RV|type=command | {{RV|type=command | ||
| arma3 | |game1= arma3 | ||
|version1= 1.48 | |||
|1.48 | |||
|gr1= Multiplayer | |gr1= Multiplayer | ||
Line 9: | Line 8: | ||
|gr2= Object Detection | |gr2= Object Detection | ||
| Returns a list of all units controlled by ''connected clients'' - human players including dead players, but also [[Arma 3 Headless Client|Headless Clients]].<br> | |descr= Returns a list of all units controlled by ''connected clients'' - human players including dead players, but also [[Arma 3 Headless Client|Headless Clients]].<br> | ||
Use [[BIS_fnc_listPlayers]] or see | Use [[BIS_fnc_listPlayers]] or see {{HashLink|#Example 1}} to only get human players. | ||
|mp= | |mp=<nowiki/> | ||
* 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. | * 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. | * The order of players in the return array may differ from server to clients. | ||
| [[allPlayers]] | |s1= [[allPlayers]] | ||
| [[Array]] of [[Object]] | |r1= [[Array]] of [[Object]] | ||
|x1= | |x1= | ||
<code>{{cc|only gets human players}} | |||
[[private]] _headlessClients = [[entities]] "HeadlessClient_F"; | |||
[[private]] _humanPlayers = [[allPlayers]] - _headlessClients;</code> | [[private]] _humanPlayers = [[allPlayers]] - _headlessClients;</code> | ||
Line 28: | Line 28: | ||
"Player %1 is %2", | "Player %1 is %2", | ||
[[name]] _x, | [[name]] _x, | ||
["dead", "alive"] [[select]] [[alive]] _x | ["dead", "alive"] [[select]] [[alive]] [[x|_x]] | ||
]; | ]; | ||
} [[forEach]] [[allPlayers]];</code> | } [[forEach]] [[allPlayers]];</code> |
Revision as of 15:40, 9 June 2021
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 only get human players. - 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:
- MultiplayerObject Detection
Syntax
- Syntax:
- allPlayers
- Return Value:
- Array of Object
Examples
- Example 1:
// only gets 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