Update GMS_fnc_playerInRange.sqf

Added an optional check such that only players on foot are detected.
This commit is contained in:
Ghostrider-DbD- 2017-02-24 20:02:47 -05:00 committed by GitHub
parent 32e61483d5
commit 210fa7d044

View File

@ -4,16 +4,25 @@
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last Modified 1/22/17
Last Modified 2/24/17
*/
/////////////////////////////////////////////////////
private ["_result"];
params["_pos","_dist"];
params["_pos","_dist",["_onFootOnly",false]];
_result = false;
if !(_onFootOnly) then
{
if ((_x distance2D _pos) < _dist) exitWith {_result = true;};
} forEach allPlayers;
{
if ((_x distance2D _pos) < _dist) exitWith {_result = true;};
} forEach allPlayers;
};
//diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2 and _result = %3",_pos,_dist,_result];
_result
if (_onFootOnly) then
{
{
if ( ((_x distance2D _pos) < _dist) && (vehicle _x isEqualTo _x)) exitWith {_result = true;};
} forEach allPlayers;
};
_result