allPlayers: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - "|=  |x3=" to "|Example2=  |x3=")  | 
				Lou Montana (talk | contribs)   (Fix description)  | 
				||
| Line 7: | Line 7: | ||
____________________________________________________________________________________________  | ____________________________________________________________________________________________  | ||
| Returns a list of all human players including dead players  | | 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 '''[[#Examples|Example 1]]''' to get human players only.  | ||
|mp=  | |||
* In player hosted game, the complete array of [[allPlayers]] may get delayed   | * 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. |Multiplayer=  | ||
____________________________________________________________________________________________  | ____________________________________________________________________________________________  | ||
|   | | [[allPlayers]] |SYNTAX=  | ||
|  | | [[Array]] of [[Object]] |RETURNVALUE=    | ||
|  | |x1= Get only human players:<code>[[private]] _headlessClients = [[entities]] "HeadlessClient_F";  | ||
[[private]] _humanPlayers = [[allPlayers]] - _allHCs;</code> |EXAMPLE1=  | |||
|  | |x2= <code>{  | ||
	[[systemChat]] [[format]] [  | 	[[systemChat]] [[format]] [  | ||
		"Player %1 is %2",    | 		"Player %1 is %2",    | ||
| Line 32: | Line 28: | ||
		["dead", "alive"] [[select]] [[alive]] _x  | 		["dead", "alive"] [[select]] [[alive]] _x  | ||
	];  | 	];  | ||
} [[forEach]] [[allPlayers]];</code>|  | } [[forEach]] [[allPlayers]];</code>|EXAMPLE2=  | ||
|x3=   | |x3= <code>[[private]] _bluNums = [[west]] [[countSide]] [[allPlayers]];</code> |EXAMPLE3=  | ||
____________________________________________________________________________________________  | ____________________________________________________________________________________________  | ||
| [[allCurators]], [[allGroups]], [[allDead]], [[allUnits]], [[switchableUnits]], [[playableUnits]], [[vehicles]], [[allUnitsUAV]], [[allDeadMen]], [[isPlayer]], [[playersNumber]] |SEEALSO=    | | [[allCurators]], [[allGroups]], [[allDead]], [[allUnits]], [[switchableUnits]], [[playableUnits]], [[vehicles]], [[allUnitsUAV]], [[allDeadMen]], [[isPlayer]], [[playersNumber]] |SEEALSO=    | ||
}}  | }}  | ||
| Line 53: | Line 43: | ||
<h3 style='display:none'>Bottom Section</h3>  | <h3 style='display:none'>Bottom Section</h3>  | ||
[[Category:  | [[Category:Command Group: Multiplayer|{{uc:{{PAGENAME}}}}]]  | ||
Revision as of 22:52, 5 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 - _allHCs; - 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