Skip to content

Commit

Permalink
Merge pull request #371 from CBATeam/cba_fnc_players
Browse files Browse the repository at this point in the history
make 'CBA_fnc_players' not return headless clients
  • Loading branch information
Killswitch00 committed Jun 8, 2016
2 parents c53e9a8 + e9872c5 commit 15d2518
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions addons/common/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class CfgFunctions {
F_FILEPATH(selectWeapon);
F_FILEPATH(switchPlayer);
F_FILEPATH(currentUnit);
F_FILEPATH(players);
};

class Vehicles {
Expand Down
5 changes: 0 additions & 5 deletions addons/common/backwards_comp.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions addons/common/fnc_players.sqf
Original file line number Diff line number Diff line change
@@ -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 <ARRAY>
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

0 comments on commit 15d2518

Please sign in to comment.