General McTavish 13 Posted March 18, 2021 So, I am trying to make a script that deletes all empty vehicles in an area defined by a marker every 5 minutes That works fine at the moment, however, I'm struggling on how to make it so if a player is within 10 meters of any vehicle then it won't delete it. Spoiler while {true} do { _og = getMarkerPos "myMarker"; _vehicles = _og nearEntities [["Car","Tank","Air"], 50]; { if ((count (vehicles inAreaArray "myMarker") > 0) && {!(count crew _x > 0)}) then { deleteVehicle _x; }; } forEach _vehicles uiSleep 300 ; }; Share this post Link to post Share on other sites
stanhope 412 Posted March 18, 2021 { private _veh = _x; if (!((getPos _veh) inAreaArray "myMarker")) then {continue;}; if (count crew _veh > 0) then {continue;}; if (({_x distance2d _veh < 10} count allPlayers) != 0) then {continue;}; deleteVehicle _x; } forEach _vehicles Something like that? Untested 1 Share this post Link to post Share on other sites
pierremgi 4907 Posted March 19, 2021 If your marker is circular, you don't need test for marker area, just apply the radius! 0 = [] spawn { _og = getMarkerPos "myMarker"; while {true} do { { private _veh = _x; if (count crew _veh == 0 && {allPlayers findIf {_veh distance2D _x < 10} == -1}) then { deleteVehicle _veh; }; } forEach ( _og nearEntities ["allVehicles", 50]); sleep 300; }; }; Share this post Link to post Share on other sites
General McTavish 13 Posted March 19, 2021 Thank you very much for the help @pierremgi and @stanhope One last question, if I have multiple markers can I put markers in array and put that in a forEach Share this post Link to post Share on other sites