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-04-17 20:45:00 +00:00
|
|
|
* [[300,300,0], 100] call FUNC(nearestPlayers)
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-17 20:45:00 +00:00
|
|
|
private ["_nearestPlayers"];
|
|
|
|
|
|
|
|
PARAMS_2(_position,_radius);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_position = _this select 0;
|
|
|
|
_radius = _this select 1;
|
|
|
|
|
|
|
|
_nearestPlayers = [];
|
|
|
|
|
|
|
|
{
|
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
|