{"name":"playersNumber","operator":null,"title":"playersNumber","type":"command","url":"https://community.bistudio.com/wiki/playersNumber","revid":369133,"updated":"2024-09-03T10:34:34Z","groups":["Multiplayer"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.80"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"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":"ofp","name":"Operation Flashpoint","version":"1.80"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns count of occupied role selection slots for given side. Players who claimed a slot in the lobby but did not start the mission are counted as well. If `disabledAI = 0;` in description.ext or *Enable AI* option is checked in Eden Editor, AI bots will be treated as valid players and will be counted too.","syntaxes":[{"syntax":"playersNumber side","since":null,"effect":null,"exec":null,"params":[{"name":"side","type":"Side","optional":false,"default":null,"description":null,"types":["Side"],"since":null,"text":"side: Side"}],"returns":{"type":"Number","types":["Number"],"description":null,"text":"Number"},"form":"unary","operator":null,"left":null,"right":{"text":"side","types":["Side"]}}],"examples":[{"text":"```sqf\n_west = playersNumber west;\n_east = playersNumber east;\n_civ = playersNumber civilian;\nhint format [\"West:%1 East:%2, Civ:%3\", _west, _east, _civ];\n```","code":["_west = playersNumber west;\n_east = playersNumber east;\n_civ = playersNumber civilian;\nhint format [\"West:%1 East:%2, Civ:%3\", _west, _east, _civ];"]}],"multiplayer":"**Multiplayer only**, in singleplayer it always returns 0.","problems":null,"aliases":[],"see_also":["playableSlotsNumber","countSide","allPlayers","allUnits"],"notes":[{"user":"Nelis75733126","date":"2015-04-13T09:44:00Z","text":"**2024-04-16 edit:**\n\n`playersNumber` returns playable AI as well as human players.\n\nBy default, a unit (placed down in the editor for example) ONLY becomes playable when the creator specifically checks the relevant checkbox.\n\nIn addition to the examples already given, this is how `playersNumber` can be used to get an array of players and playable AI on the same side as the side of the player:\n\n```sqf\nplayersNumber playerSide;\n```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Multiplayer","Introduced with Operation Flashpoint version 1.80","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}