Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 4.99 KB | None | 0 0
  1. {
  2.     if (!alive _x) then {
  3.         _dbInfo = _x getVariable["dbInfo", []];
  4.         if (count _dbInfo > 0) then {
  5.             _uid = _dbInfo select 0;
  6.             _plate = _dbInfo select 1;
  7.             _insureSystem = 1;
  8.             if ((count _dbInfo) < 3) then {
  9.                 _insureSysten = 0;
  10.             } else {
  11.                 _insureSystem = _dbInfo select 2;
  12.             };
  13.             diag_log "destroy vehicle!";
  14.             diag_log format["insureSystem = %1", _insureSystem];
  15.             if (_insureSystem == 1) then {
  16.                 diag_log "Insured!";
  17.                 diag_log format["insureSystem = %1", _insureSystem];
  18.                 _query_0 = format["UPDATE vehicles SET alive = '1', insure = '0', active = '0' WHERE pid = '%1' AND plate = '%2'", _uid, _plate];
  19.                 _query_0 spawn {
  20.                     _thread_0 = [_this, 1] call HC_fnc_asyncCall;
  21.                 };
  22.             } else {
  23.                 diag_log "Not Insured!";
  24.                 _query = format["UPDATE vehicles SET alive = '0' WHERE pid = '%1' AND plate = '%2'", _uid, _plate];
  25.                 _query spawn {
  26.                     _thread = [_this, 1] call HC_fnc_asyncCall;
  27.                 };
  28.             };
  29.         };
  30.         if (!isNil "_x" && {!isNull _x}) then {
  31.             deleteVehicle _x;
  32.         };
  33.     } else {
  34.         _dbInfo = _x getVariable["dbInfo", []];
  35.         if ((count _dbInfo > 0) && ((count (crew _x)) < 1) && (_x getVariable ["knackbar",true])) then {
  36.             _uid = _dbInfo select 0;
  37.             _plate = _dbInfo select 1;
  38.             if ((serverTime - (_x getVariable ["lastAcc", 1])) > 0) then {
  39.                 _nearUnits = nearestObjects [player, ["man"], 500];
  40.                 _ownerArray = _x getVariable ["vehicle_info_owners", []];
  41.                 _found = false;
  42.                 if (_x getVariable ["CopCar",false]) then {
  43.                     {
  44.                         if ((side _x) isEqualTo west) exitWith {
  45.                             _found = true;
  46.                         };
  47.                     } forEach _nearUnits;
  48.                 } else {
  49.                     {
  50.                         if ([(_x getVariable ["PID", -1]), _x getVariable ["realname",name player]] in _ownerArray) exitWith {
  51.                             _found = true;
  52.                         };
  53.                     } forEach _nearUnits;
  54.                 };
  55.                 if !(_found) then {
  56.                     _query_0 = format["UPDATE vehicles SET active = '0' WHERE pid = '%1' AND plate = '%2'", _uid, _plate];
  57.                     _query_0 spawn {
  58.                         _thread_0 = [_this, 1] call HC_fnc_asyncCall;
  59.                     };
  60.                     if (!isNil "_x" && {!isNull _x}) then {
  61.                         deleteVehicle _x;
  62.                     };
  63.                 };
  64.             };
  65.         };
  66.     };
  67. } foreach allMissionObjects "LandVehicle";
  68.  
  69. {
  70.     if (!alive _x) then {
  71.         _dbInfo = _x getVariable["dbInfo", []];
  72.         if (count _dbInfo > 0) then {
  73.             _uid = _dbInfo select 0;
  74.             _plate = _dbInfo select 1;
  75.             _insureSystem = 1;
  76.             if ((count _dbInfo) < 3) then {
  77.                 _insureSysten = 0;
  78.             } else {
  79.                 _insureSystem = _dbInfo select 2;
  80.             };
  81.             diag_log "destroy vehicule!";
  82.             diag_log format["insureSystem = %1", _insureSystem];
  83.             if (_insureSystem == 1) then {
  84.                 diag_log " Insured!";
  85.                 diag_log format["insureSystem = %1", _insureSystem];
  86.                 _query_0 = format["UPDATE vehicles SET alive = '1', insure = '0', active = '0' WHERE pid = '%1' AND plate = '%2'", _uid, _plate];
  87.                 _query_0 spawn {
  88.                     _thread_0 = [_this, 1] call HC_fnc_asyncCall;
  89.                 };
  90.             } else {
  91.                 diag_log "Not Insured!";
  92.                 _query = format["UPDATE vehicles SET alive = '0' WHERE pid = '%1' AND plate = '%2'", _uid, _plate];
  93.                 _query spawn {
  94.                     _thread = [_this, 1] call HC_fnc_asyncCall;
  95.                 };
  96.             };
  97.         };
  98.         if (!(isNil "_x") && {!isNull _x}) then {
  99.             deleteVehicle _x;
  100.         };
  101.     } else {
  102.         _dbInfo = _x getVariable["dbInfo", []];
  103.         if ((count _dbInfo > 0) && ((count (crew _x)) < 1) && (_x getVariable ["knackbar",true])) then {
  104.             _uid = _dbInfo select 0;
  105.             _plate = _dbInfo select 1;
  106.             if ((serverTime - (_x getVariable ["lastAcc", 1])) > 0) then {
  107.                 _nearUnits = nearestObjects [player, ["man"], 500];
  108.                 _ownerArray = _x getVariable ["vehicle_info_owners", []];
  109.                 _found = false;
  110.                 if (_x getVariable ["CopCar",false]) then {
  111.                     {
  112.                         if ((side _x) isEqualTo west) exitWith {
  113.                             _found = true;
  114.                         };
  115.                     } forEach _nearUnits;
  116.                 } else {
  117.                     {
  118.                         if ([(_x getVariable ["PID", -1]), _x getVariable ["realname",name player]] in _ownerArray) exitWith {
  119.                             _found = true;
  120.                         };
  121.                     } forEach _nearUnits;
  122.                 };
  123.                 if !(_found) then {
  124.                     _query_0 = format["UPDATE vehicles SET active = '0' WHERE pid = '%1' AND plate = '%2'", _uid, _plate];
  125.                     _query_0 spawn {
  126.                         _thread_0 = [_this, 1] call HC_fnc_asyncCall;
  127.                     };
  128.                     if (!isNil "_x" && {!isNull _x}) then {
  129.                         deleteVehicle _x;
  130.                     };
  131.                 };
  132.             };
  133.         };
  134.     };
  135. } foreach allMissionObjects "Air";
  136.  
  137. _cars = time;
  138.  
  139. //Group cleanup.
  140. {
  141.     if (((count units _x) == 0) && (local _x)) then {
  142.         deleteGroup _x;
  143.     };
  144. } foreach allGroups;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement