how do i check distance?

I am trying to set a variable as true when a player gets close to a vehicle

I can't use wait till because I am checking 2

what do i change the "if" statements to?

Code:
if ((isPlayer _x) && ((_x distance _jet1) < 30)) then {
    _heroCleared = true;
    diag_log format["MISSION SYSTEM: Hero jet taken."];
    Ccoords = _heroCoords;
    publicVariable "Ccoords";
    [] execVM "debug\remmarkersHero.sqf";
    if (!_banditCleared) then {
        [nil,nil,rTitleText,"Hero jet secured, hope that runway is cleared!", "PLAIN",6] call RE;
        [nil,nil,rGlobalRadio,"Hero jet secured, hope that runway is cleared!"] call RE;
        [nil,nil,rHINT,"Hero jet secured, hope that runway is cleared!"] call RE;
    };
};
if ((isPlayer _x) && (_x distance _jet2) < 30) then {
    _banditCleared = true;
    diag_log format["MISSION SYSTEM: Bandit jet taken."];
    Ccoords = _banditCoords;
    publicVariable "Ccoords";
    [] execVM "debug\remmarkersBandit.sqf";
    if (!_heroCleared) then {
        [nil,nil,rTitleText,"Bandit jet secured, hope that runway is cleared!", "PLAIN",6] call RE;
        [nil,nil,rGlobalRadio,"Bandit jet secured, hope that runway is cleared!"] call RE;
        [nil,nil,rHINT,"Bandit jet secured, hope that runway is cleared!"] call RE;
    };
};
 
Where you have "30" in the if statement is the distance in meters. Its checking if _x is a player, and if so, if they are within 30meters of the _jet1 or _jet2.
 
Back
Top