allPlayers: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "{{HashLink" to "{{Link") |
(Added info about Virtual Entities) |
||
Line 8: | Line 8: | ||
|gr2= Object Detection | |gr2= Object Detection | ||
|descr= Returns a list of all units controlled by | |descr= Returns a list of all units controlled by connected clients. This includes: | ||
* Normal human players (including dead players) | |||
* [[Eden Editor: System#Virtual Entities|Virtual Entities]] (see ''Systems'' → ''Logic Entities'' → ''Virtual Entities'' in the [[Eden Editor]]) | |||
** [[Arma 3: Headless Client|Headless Clients]] ({{hl|HeadlessClient_F}}) | |||
** Virtual Curators ({{hl|VirtualCurator_F}}, {{hl|*_VirtualCurator_F}}) | |||
** Virtual Spectators ({{hl|VirtualSpectator_F}}) | |||
Use [[BIS_fnc_listPlayers]] or see {{Link|#Example 1}} to only get human players. | Use [[BIS_fnc_listPlayers]] or see {{Link|#Example 1}} to only get human players. | ||
|mp=<nowiki/> | |mp=<nowiki/> | ||
* The complete array of [[allPlayers]] may get delayed on mission start in multiplayer. Use [[BIS_fnc_listPlayers]] | * 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 order of the returned array may differ from server to clients. | ||
|s1= [[allPlayers]] | |s1= [[allPlayers]] | ||
|r1= [[Array]] of [[Object]] | |r1= [[Array]] of [[Object]]s | ||
|x1= Get human players (i.e. all players excluding Headless Clients): | |||
<sqf> | |||
private _players = allPlayers - entities "HeadlessClient_F"; | |||
</sqf> | |||
| | |x2= Get non-virtual players (i.e. all players excluding Virtual Entities): | ||
<sqf> | <sqf> | ||
private | private _players = allPlayers select {!(_x isKindOf "VirtualMan_F")}; | ||
</sqf> | |||
| | |x3= <sqf>{ | ||
systemChat format [ | systemChat format [ | ||
"Player %1 is %2", | "Player %1 is %2", | ||
Line 32: | Line 43: | ||
} forEach allPlayers;</sqf> | } forEach allPlayers;</sqf> | ||
| | |x4= <sqf>private _bluforPlayers = blufor countSide allPlayers;</sqf> | ||
|seealso= [[allCurators]] [[allGroups]] [[allDead]] [[allUnits]] [[switchableUnits]] [[playableUnits]] [[vehicles]] [[allUnitsUAV]] [[allDeadMen]] [[isPlayer]] [[playersNumber]] [[allUsers]] [[getUserInfo]] | |seealso= [[allCurators]] [[allGroups]] [[allDead]] [[allUnits]] [[switchableUnits]] [[playableUnits]] [[vehicles]] [[allUnitsUAV]] [[allDeadMen]] [[isPlayer]] [[playersNumber]] [[allUsers]] [[getUserInfo]] | ||
}} | }} |
Revision as of 12:42, 14 March 2023
Description
- Description:
- Returns a list of all units controlled by connected clients. This includes:
- Normal human players (including dead players)
- Virtual Entities (see Systems → Logic Entities → Virtual Entities in the Eden Editor)
- Headless Clients (HeadlessClient_F)
- Virtual Curators (VirtualCurator_F, *_VirtualCurator_F)
- Virtual Spectators (VirtualSpectator_F)
- 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):
- Example 2:
- Get non-virtual players (i.e. all players excluding Virtual Entities):
- Example 3:
- Example 4:
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