Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make 'CBA_fnc_players' not return headless clients #371

Merged
merged 3 commits into from
Jun 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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