2016-06-02 21:18:09 +00:00
|
|
|
/*
|
|
|
|
Author: IT07
|
|
|
|
|
|
|
|
Description:
|
|
|
|
checks for players within given distance of given location/position
|
|
|
|
|
|
|
|
Params:
|
|
|
|
_this select 0: POSITION - center of area to check around
|
|
|
|
_this select 1: SCALAR - radius around the position to check for players
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
BOOL - true if player(s) found
|
|
|
|
*/
|
|
|
|
|
2016-06-17 10:27:05 +00:00
|
|
|
private ["_found","_pos","_rad"];
|
2016-06-02 21:18:09 +00:00
|
|
|
// By default, we assume that there are no players close. The distance check below should prove otherwise if there are players close
|
|
|
|
_found = false;
|
2016-06-17 10:27:05 +00:00
|
|
|
params [["_pos",[],[[]]], ["_rad",-1,[0]]];
|
|
|
|
if (((count _pos) isEqualTo 3) AND (_rad > -1)) then
|
2016-06-02 21:18:09 +00:00
|
|
|
{
|
2016-06-17 10:27:05 +00:00
|
|
|
{
|
|
|
|
if (isPlayer _x AND speed _x < 250) then
|
2016-06-02 21:18:09 +00:00
|
|
|
{
|
2016-06-17 10:27:05 +00:00
|
|
|
private ["_isClose"];
|
|
|
|
_isClose = if ((position _x distance _pos) < _rad) then { true } else { false };
|
|
|
|
if _isClose then { _found = true };
|
|
|
|
};
|
|
|
|
} forEach allPlayers;
|
2016-06-02 21:18:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_found
|