a3_vemf_reloaded/exile_vemf_reloaded/functions/fn_playerCount.sqf

40 lines
775 B
Plaintext
Raw Normal View History

2016-04-06 16:04:51 +00:00
/*
Author: IT07
Description:
checks if player count is above or equal to given number. If no number given, default of 1 will be used.
Params:
none
Returns:
ARRAY - [false if current player count is below minimum, true if (more than OR equalTo) minimum]
*/
2016-04-13 20:28:31 +00:00
private ["_ok"];
2016-04-06 16:04:51 +00:00
_ok = false;
if (_this isEqualType []) then
{
2016-04-13 20:28:31 +00:00
private ["_minimum"];
_minimum = param [0, -1, [0]];
if (_minimum > -1) then
{
if (count allPlayers >= _minimum) then
{
_players = 0;
{
if (isPlayer _x) then
2016-04-06 16:04:51 +00:00
{
2016-04-13 20:28:31 +00:00
_players = _players + 1;
2016-04-06 16:04:51 +00:00
};
2016-04-13 20:28:31 +00:00
} forEach allPlayers;
if not(_players isEqualTo 0) then
{
_ok = true
};
};
};
2016-04-06 16:04:51 +00:00
};
_ok