playersNumber: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(79 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|P]]
{{RV|type=command
[[Category:Scripting Commands OFP 1.97|P]]
[[Category:Scripting Commands ArmA|P]]


back to [[Scripting_Reference#P|COMREF]]
|game1= ofp
|version1= 1.80


<h2 style="color:#000066">'''playersNumber ''side'''''</h2>
|game2= ofpe
|version2= 1.00


|game3= arma1
|version3= 1.00


'''Operand types:'''
|game4= arma2
|version4= 1.00


'''side:''' [[Side]]
|game5= arma2oa
|version5= 1.50


'''Type of returned value:'''
|game6= tkoh
|version6= 1.00


[[Number]]
|game7= arma3
|version7= 0.50


'''Compatibility:'''
|gr1= Multiplayer


Added in version '''1.80'''
|descr= 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 <syntaxhighlight lang="cpp" inline>disabledAI = 0;</syntaxhighlight> in [[Description.ext#disabledAI|description.ext]] or ''Enable AI'' option is checked in [[:Category:Eden Editor|Eden Editor]], AI bots will be treated as valid players and will be counted too.


'''Description:'''
|mp= '''Multiplayer only''', in singleplayer it always returns 0.


Return count of players playing on given side.
|s1= [[playersNumber]] side
 
|p1= side: [[Side]]
 
|r1= [[Number]]
 
|x1= <sqf>
_west = playersNumber west;
_east = playersNumber east;
_civ = playersNumber civilian;
hint format ["West:%1 East:%2, Civ:%3", _west, _east, _civ];
</sqf>
 
|seealso= [[playableSlotsNumber]] [[countSide]] [[allPlayers]] [[allUnits]]
}}
 
{{Note
|user= Nelis75733126
|timestamp= 20150413094400
|text= '''2024-04-16 edit:'''<br>
<sqf inline>playersNumber</sqf> returns playable AI as well as human players.<br>
By default, a unit (placed down in the editor for example) ONLY becomes playable when the creator specifically checks the relevant checkbox.<br>
<br>
In addition to the examples already given, this is how <sqf inline>playersNumber</sqf> can be used to get an array of players and playable AI on the same side as the side of the player:<br>
<sqf>playersNumber playerSide;</sqf>
|game= arma1
|version= 1.05
}}

Latest revision as of 11:34, 3 September 2024

Hover & click on the images for description

Description

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.
Multiplayer:
Multiplayer only, in singleplayer it always returns 0.
Groups:
Multiplayer

Syntax

Syntax:
playersNumber side
Parameters:
side: Side
Return Value:
Number

Examples

Example 1:
_west = playersNumber west; _east = playersNumber east; _civ = playersNumber civilian; hint format ["West:%1 East:%2, Civ:%3", _west, _east, _civ];

Additional Information

See also:
playableSlotsNumber countSide allPlayers allUnits

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
Nelis75733126 - c
Posted on Apr 13, 2015 - 09:44 (UTC)

2024-04-16 edit:
playersNumber returns playable AI as well as human players.
By default, a unit (placed down in the editor for example) ONLY becomes playable when the creator specifically checks the relevant checkbox.

In 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:

playersNumber playerSide;