diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index d37741af2..24cd658bd 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -37,6 +37,7 @@ class CfgFunctions { F_FILEPATH(selectWeapon); F_FILEPATH(switchPlayer); F_FILEPATH(currentUnit); + F_FILEPATH(players); }; class Vehicles { diff --git a/addons/common/backwards_comp.sqf b/addons/common/backwards_comp.sqf index 99bf8c346..1ea069aa6 100644 --- a/addons/common/backwards_comp.sqf +++ b/addons/common/backwards_comp.sqf @@ -5,11 +5,6 @@ CBA_fnc_createCenter = { _side }; -CBA_fnc_players = { - WARNING('Deprecated function used: CBA_fnc_players (new: allPlayers)'); - allPlayers -}; - CBA_fnc_locked = { WARNING('Deprecated function used: CBA_fnc_locked (new: locked)'); locked _this > 1 diff --git a/addons/common/fnc_players.sqf b/addons/common/fnc_players.sqf new file mode 100644 index 000000000..a00b2d9d1 --- /dev/null +++ b/addons/common/fnc_players.sqf @@ -0,0 +1,26 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_players + +Description: + Reports all (human) player objects. Does not include headless client entities. + + Unlike "BIS_fnc_listPlayers", this function will not report the game logics of headless clients. + +Parameters: + None + +Returns: + List of all player objects + +Examples: + (begin example) + [] call CBA_fnc_players + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(players); + +[allUnits + allDead, {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}}] call BIS_fnc_conditionalSelect