allPlayers: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= |x3=" to "|Example2= |x3=")
(Fix description)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns a list of all human players including dead players. The command also returns all connected headless clients. To filter headless clients out:
| Returns a list of all units controlled by ''connected clients'' - human players including dead players, but also [[Arma 3 Headless Client|Headless Clients]].<br>
<code>_justPlayers <nowiki>=</nowiki> [[allPlayers]] - [[entities]] "HeadlessClient_F";</code>
Use [[BIS_fnc_listPlayers]] or see '''[[#Examples|Example 1]]''' to get human players only.


'''NOTES:'''
|mp=
* In player hosted game, the complete array of [[allPlayers]] may get delayed at the 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 |DESCRIPTION=
* The order of players in the return array may differ from server to clients. |Multiplayer=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''allPlayers''' |SYNTAX=
| [[allPlayers]] |SYNTAX=


|p1= |PARAMETER1=  
| [[Array]] of [[Object]] |RETURNVALUE=  


|p2= |PARAMETER2=  
|x1= Get only human players:<code>[[private]] _headlessClients = [[entities]] "HeadlessClient_F";
[[private]] _humanPlayers = [[allPlayers]] - _allHCs;</code> |EXAMPLE1=


|p3= |PARAMETER3=
|x2= <code>{
 
| [[Array]] |RETURNVALUE=
 
 
|x1= <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>|EXAMPLE1=
} [[forEach]] [[allPlayers]];</code>|EXAMPLE2=
 
|x2= <code>_bluNums = [[west]] [[countSide]] [[allPlayers]];</code> |Example2=


|x3= Find all human players if headless clients are used:<code>_allHCs = [[entities]] "HeadlessClient_F";
|x3= <code>[[private]] _bluNums = [[west]] [[countSide]] [[allPlayers]];</code> |EXAMPLE3=
_allHPs = [[allPlayers]] - _allHCs;</code> |=


____________________________________________________________________________________________
____________________________________________________________________________________________


| [[allCurators]], [[allGroups]], [[allDead]], [[allUnits]], [[switchableUnits]], [[playableUnits]], [[vehicles]], [[allUnitsUAV]], [[allDeadMen]], [[isPlayer]], [[playersNumber]] |SEEALSO=  
| [[allCurators]], [[allGroups]], [[allDead]], [[allUnits]], [[switchableUnits]], [[playableUnits]], [[vehicles]], [[allUnitsUAV]], [[allDeadMen]], [[isPlayer]], [[playersNumber]] |SEEALSO=  
|  |MPBEHAVIOUR=
____________________________________________________________________________________________
}}
}}


Line 53: Line 43:


<h3 style='display:none'>Bottom Section</h3>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma 3: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Command Group: Multiplayer|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Multiplayer|{{uc:{{PAGENAME}}}}]]

Revision as of 23:52, 5 April 2020

Hover & click on the images for description

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

Notes

Bottom Section