{"name":"playableUnits","operator":null,"title":"playableUnits","type":"command","url":"https://community.bistudio.com/wiki/playableUnits","revid":376985,"updated":"2026-01-01T07:13:32Z","groups":["Multiplayer","Object Detection"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns a list of playable units in a multiplayer game (occupied by both AI or players), created on the following sides east/opfor, west/blufor, resistance/independent and civilian only.\nDoes not contain units of sideLogic.\n\n> [!NOTE]\n> This command returns an empty array in Singleplayer; use switchableUnits instead.\n\n> [!IMPORTANT]\n> This command does not include dead players awaiting for respawn.","syntaxes":[{"syntax":"playableUnits","since":null,"effect":null,"exec":null,"params":[],"returns":{"type":"Array of Objects","types":["Array","Object"],"description":null,"text":"Array of Objects"},"form":"nullary","operator":null,"left":null,"right":null}],"examples":[{"text":"```sqf\n{ _x groupChat \"I'm a playable unit.\"; } forEach playableUnits;\n```","code":["{ _x groupChat \"I'm a playable unit.\"; } forEach playableUnits;"]},{"text":"```sqf\n_playableInGroup = units group player arrayIntersect playableUnits;\n```","code":["_playableInGroup = units group player arrayIntersect playableUnits;"]},{"text":"```sqf\n_nonPlayableInGroup = units group player - playableUnits;\n```","code":["_nonPlayableInGroup = units group player - playableUnits;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["playableSlotsNumber","allPlayers","allCurators","allGroups","allDead","switchableUnits","vehicles","allUnitsUAV","allDeadMen","isPlayer","playersNumber"],"notes":[{"user":"DreadedEntity","date":"2014-12-23T23:13:00Z","text":"To get a list of all player-controlled units:\n\n```sqf\n_allPlayers = [];\n{\n    if (isPlayer _x) then\n    {\n        _allPlayers pushBack _x;\n    };\n} forEach playableUnits;\n```"},{"user":"FR Starfox64","date":"2015-08-16T10:05:00Z","text":"playableUnits will not return dead players, use allPlayers instead."},{"user":"Pierre MGI","date":"2017-02-14T22:05:00Z","text":"Using the Editor (multiplayer attributes) for unchecking \"enable AI\", or disabling AI(s) in lobby, will make playableUnits as a public variable,  updated by each JIP on disabled slot.\nSo, if all slots are disabled AI, playableUnits is same as allPlayers\n\nFurthermore, in this case, non-played slot (playable and disabled AI) units simply don't exist!\n\ni.e. If you name 8 playable units: u1..u8, then 2 players in game: u3 & u6\n\nplayableUnits will return [u3,u6], and true for  isNil \"u1\", isNil \"u2\"... until another player takes the slot."}],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Multiplayer","Command Group: Object Detection","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}