allPlayers: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Eden Editor" to "Eden Editor")
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
Line 35: Line 35:
</sqf>
</sqf>


|x3= <sqf>{
|x3= <sqf>
{
systemChat format [
systemChat format [
"Player %1 is %2",  
"Player %1 is %2",  
Line 41: Line 42:
["dead", "alive"] select alive _x
["dead", "alive"] select alive _x
];
];
} forEach allPlayers;</sqf>
} forEach allPlayers;
</sqf>


|x4= <sqf>private _bluforPlayers = blufor countSide allPlayers;</sqf>
|x4= <sqf>private _bluforPlayers = blufor countSide allPlayers;</sqf>

Latest revision as of 12:25, 3 September 2024

Hover & click on the images for description

Description

Description:
Returns a list of all units controlled by connected clients. This includes:
  • Normal human players (including dead players)
  • Virtual Entities (see SystemsLogic EntitiesVirtual Entities in the Eden Editor)
    • Headless Clients (HeadlessClient_F)
    • Virtual Curators (VirtualCurator_F, *_VirtualCurator_F)
    • Virtual Spectators (VirtualSpectator_F)
Use BIS_fnc_listPlayers or see Example 1 to only get human players.
Multiplayer:
  • The complete array of allPlayers may get delayed on mission start in multiplayer. Use BIS_fnc_listPlayers to obtain it earlier.
  • The order of the returned array may differ from server to clients.
Groups:
MultiplayerObject Detection

Syntax

Syntax:
allPlayers
Return Value:
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;

Additional Information

See also:
allCurators allGroups allDead allUnits switchableUnits playableUnits vehicles allUnitsUAV allDeadMen isPlayer playersNumber allUsers getUserInfo

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