daily pastebin goal
14%
SHARE
TWEET

safezone_ai_remover.sqf

a guest Nov 18th, 2017 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //SAFEZONES UNITS AND VEHICLES REMOVER FROM SAFEZONES BY NOVA AND JUANDAYZ
  2.  
  3. private ["_playerpos","_ai_to_be_removed","_Safezone_radio","_all_nearest_veh","_delete","_veh","_classes_list","_classCount","_classes"];
  4.  
  5.  
  6. while {true} do {
  7.  
  8. waitUntil {isInTraderCity};
  9.  
  10. _playerpos = getPos (vehicle player);
  11. _player = player;
  12. _ai_to_be_removed = _playerpos nearEntities ["Man",350];
  13. _Safezone_radio = 350;
  14. _all_nearest_veh = _playerpos nearEntities [["LandVehicle","Helicopter","Plane","Ship"],_Safezone_radio];
  15.  
  16. {
  17. if ((_x in allunits) and !(_x in serverTraders) and !(_x in playableunits))then{
  18.  
  19. _x setdamage 1;
  20. deletevehicle _x;
  21. };
  22.  
  23. } forEach _ai_to_be_removed;
  24.  
  25. {
  26. if (vehicle _x getVariable ["aiveh",0] == 1) then {
  27. if (_player == driver _x) then {
  28. _x setVariable ["aiveh",0];
  29. }else{
  30. deletevehicle _x;
  31. _vehicleID = _x getVariable ["ObjectID", "0"];
  32. _vehicleUID = _x getVariable ["ObjectUID", "0"];
  33. [_vehicleID,_vehicleUID] call server_deleteObj;
  34. PVDZ_obj_Destroy = [_vehicleID,_vehicleUID,_x];
  35. publicVariableServer "PVDZ_obj_Destroy";
  36. };
  37. };
  38. } forEach _all_nearest_veh;
  39.  
  40.  
  41. _delete = 0;
  42.                 {
  43.                     _veh = _x;
  44.                     if(!isNull _veh)then
  45.                     {
  46.  if((damage _veh)>=0.99)then {
  47. _delete = _delete + 1;deleteVehicle _veh;
  48. _vehicleID = _veh getVariable ["ObjectID", "0"];
  49. _vehicleUID = _veh getVariable ["ObjectUID", "0"];
  50. [_vehicleID,_vehicleUID] call server_deleteObj;
  51. PVDZ_obj_Destroy = [_vehicleID,_vehicleUID,_veh];
  52. publicVariableServer "PVDZ_obj_Destroy";
  53.                    };
  54.                     };
  55.                    
  56.                 } forEach (vehicles);
  57.                
  58. _classes =
  59.                 [
  60.                     "crater","craterlong","PartWoodPile",
  61.                     "SeaGull","Rabbit","WildBoar","Cow","Goat","Sheep","Bird","wire_cat1",
  62.                     "CAAnimalBase"
  63.                 ];
  64.                 {
  65.                     _classes_list     = allMissionObjects _x;
  66.                     _classCount     = (count _classes_list);
  67.                     {
  68.                        
  69.                             deleteVehicle _x;
  70.                        
  71.                     } forEach (allMissionObjects _x);
  72.                 } forEach _classes;                
  73.  
  74. uiSleep 5;
  75. };
RAW Paste Data
Top