2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 22:28:27 +00:00
|
|
|
* Author: bux578
|
|
|
|
* Returns an array of alive players in a given radius around a given location
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Center position <POSTION>
|
|
|
|
* 1: Radius <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Player units <ARRAY<OBJECT>>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-08-07 07:18:42 +00:00
|
|
|
* [[300,300,0], 100] call ace_switchunits_fnc_nearestPlayers
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-07 07:18:42 +00:00
|
|
|
params ["_position", "_radius"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2016-01-10 18:08:28 +00:00
|
|
|
private _nearestPlayers = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
{
|
2015-04-17 20:45:00 +00:00
|
|
|
if ([_x] call EFUNC(common,isPlayer) && {alive _x}) then {
|
|
|
|
_nearestPlayers pushBack _x;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
} forEach (nearestObjects [_position, ["Man"], _radius]);
|
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
_nearestPlayers
|