Advertisement
Guest User

Untitled

a guest
Oct 16th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 9.88 KB | None | 0 0
  1. private ["_pIts","_vehicle_nearestDoors","_vehicle_nearestGatePanel","_vehicle_nearestRoofGatePanel","_cnt","_remoteDoorClassname","_remoteIsWoodGarage","_remoteIsCinderGarage","_remoteLatchClosed","_remoteLatchOpen","_remoteHingeClosed","_remoteHingeOpen","_remoteDoorClosed","_remoteDoorOpen","_remoteDoorCode"];
  2. player_currentVehicle removeAction s_vehicle_remote;
  3. s_vehicle_remote = -1;
  4. _pIts = items player;
  5. if (!("ItemRadio" in _pIts)) exitWith {
  6.     titleText["Sorry, you need a Radio to use this function!", "PLAIN", 3];
  7.     sleep 10;
  8.     s_vehicle_remote = -1;
  9. };
  10. s_vehicle_remotedoorunlockcode = -1;
  11. s_vehicle_remotedoorunlock = -1;
  12. s_vehicle_remotedooropen = -1;
  13. s_vehicle_remotedoorclose = -1;
  14. s_vehicle_remotedoorlockcode = -1;
  15. s_vehicle_remotedoorlock = -1;
  16. s_vehicle_enterCodeRemote = -1;
  17. s_vehicle_remotegateup = -1;
  18. s_vehicle_remotegatedown = -1;
  19. keyValid = false;
  20. gateAccess = false;
  21. _vehicle_nearestGatePanel = nearestObjects [player_currentVehicle, ["Infostand_2_EP1","Infostand_1_EP1"], 30];
  22. if (count _vehicle_nearestGatePanel > 0) then {
  23.     vehicle_near_GatePanel = _vehicle_nearestGatePanel select 0;
  24. } else {
  25.     vehicle_near_GatePanel = objNull;
  26. };
  27. _vehicle_nearestDoors = nearestObjects [player_currentVehicle, ["CinderWallDoorLocked_DZ","Land_DZE_GarageWoodDoorLocked"], 30];
  28. if (count _vehicle_nearestDoors > 0) then {
  29.     vehicle_near_lockedDoor = _vehicle_nearestDoors select 0;
  30. } else {
  31.     vehicle_near_lockedDoor = objNull;
  32. };
  33. if (isNull vehicle_near_GatePanel && isNull vehicle_near_lockedDoor) exitWith {
  34.     titleText["Sorry, no Gate-Panels or Garages found in range...", "PLAIN", 3];
  35.     s_vehicle_remote = -1;
  36. };
  37. titleText ["### Gate-Panel or Garage found ### Control activated for 60 seconds ###", "PLAIN", 1];
  38. sleep 1;
  39. _cnt = 59;
  40. gateAccess = true;
  41. while {gateAccess} do
  42. {
  43.     if (_cnt == 0) exitWith {
  44.         titleText ["### Time is up ### Remote connection Terminated ###", "PLAIN", 3];
  45.     };
  46.     titleText [format["### Remote connection get terminated in %1 seconds ###", _cnt], "PLAIN",1];
  47.     if ((vehicle player) == player) exitWith {
  48.         titleText ["### You left the Vehicle ### Remote connection Terminated ###", "PLAIN", 3];
  49.     };
  50.     if (!isNull vehicle_near_lockedDoor) then {
  51.         if (vehicle_near_lockedDoor distance player_currentVehicle <= 30 && vehicle_near_lockedDoor distance player_currentVehicle >= 3) then {
  52.             _remoteDoorClassname = (vehicle_near_lockedDoor getVariable["Classname","0"]);
  53.             _remoteIsWoodGarage = (_remoteDoorClassname == "Land_DZE_GarageWoodDoorLocked");
  54.             _remoteIsCinderGarage = (_remoteDoorClassname == "CinderWallDoorLocked_DZ");
  55.             _remoteLatchClosed = (vehicle_near_lockedDoor animationPhase "Open_latch" == 0);
  56.             _remoteLatchOpen = (vehicle_near_lockedDoor animationPhase "Open_latch" == 1);
  57.             _remoteHingeClosed = (vehicle_near_lockedDoor animationPhase "Open_hinge" == 0);
  58.             _remoteHingeOpen = (vehicle_near_lockedDoor animationPhase "Open_hinge" == 1);
  59.             _remoteDoorClosed = (vehicle_near_lockedDoor animationPhase "Open_door" == 0);
  60.             _remoteDoorOpen = (vehicle_near_lockedDoor animationPhase "Open_door" == 1);
  61.             _remoteDoorCode = (vehicle_near_lockedDoor getvariable['CharacterID','0']);
  62.             if (_remoteDoorClosed && ((_remoteIsCinderGarage && _remoteLatchClosed) || (_remoteIsWoodGarage && _remoteHingeClosed))) then {
  63.                 if (DZE_Lock_Door != _remoteDoorCode) then {
  64.                     if (s_vehicle_remotedoorunlock != -1) then {
  65.                         player_currentVehicle removeAction s_vehicle_remotedoorunlock;
  66.                         s_vehicle_remotedoorunlock = -1;
  67.                     };
  68.                     if (s_vehicle_remotedoorunlockcode <0) then {
  69.                         s_vehicle_remotedoorunlockcode = player_currentVehicle addAction  [("<t color=""#FF4000"">" + ("Unlock Door") +"</t>"), "custom\vehicle_remotedoorcode.sqf",player_currentVehicle,1, true, true, "",""];
  70.                     };
  71.                 } else {
  72.                     if (s_vehicle_remotedoorunlockcode != -1) then {
  73.                         player_currentVehicle removeAction s_vehicle_remotedoorunlockcode;
  74.                         s_vehicle_remotedoorunlockcode = -1;
  75.                     };
  76.                     if (s_vehicle_remotedoorunlock <0) then {
  77.                         s_vehicle_remotedoorunlock = player_currentVehicle addAction [("<t color=""#FF4000"">" + ("Unlock Door") +"</t>"), "custom\vehicle_remoteunlockdoor.sqf","",1,true,true,"",""];
  78.                     };
  79.                 };
  80.             } else {
  81.                 player_currentVehicle removeAction s_vehicle_remotedoorunlock;
  82.                 s_vehicle_remotedoorunlock = -1;
  83.                 player_currentVehicle removeAction s_vehicle_remotedoorunlockcode;
  84.                 s_vehicle_remotedoorunlockcode = -1;
  85.             };
  86.             if (_remoteDoorClosed and ((_remoteIsCinderGarage && _remoteLatchOpen) || (_remoteIsWoodGarage && _remoteHingeOpen))) then {
  87.                 if (vehicle_remotedooropen <0) then {
  88.                     vehicle_remotedooropen = player_currentVehicle addAction [("<t color=""#FF4000"">" + ("Open Door") +"</t>"), "custom\vehicle_remoteopendoor.sqf","",1,true,true,"",""];
  89.                 };
  90.             } else {
  91.                 player_currentVehicle removeAction vehicle_remotedooropen;
  92.                 vehicle_remotedooropen = -1;
  93.             };
  94.            
  95.             if (_remoteDoorOpen and ((_remoteIsCinderGarage && _remoteLatchOpen) || (_remoteIsWoodGarage && _remoteHingeOpen))) then {
  96.                 if (vehicle_remotedoorclose <0) then {
  97.                     vehicle_remotedoorclose = player_currentVehicle addAction [("<t color=""#FF4000"">" + ("Close Door") +"</t>"), "custom\vehicle_remoteclosedoor.sqf","",1,true,true,"",""];
  98.                 };
  99.             } else {
  100.                 player_currentVehicle removeAction vehicle_remotedoorclose;
  101.                 vehicle_remotedoorclose = -1;
  102.             };
  103.             if (_remoteDoorClosed && ((_remoteIsCinderGarage && _remoteLatchOpen) || (_remoteIsWoodGarage && _remoteHingeOpen))) then {
  104.                 if (DZE_Lock_Door != _remoteDoorCode) then {
  105.                     if (s_vehicle_remotedoorlock != -1) then {
  106.                         player_currentVehicle removeAction s_vehicle_remotedoorlock;
  107.                         s_vehicle_remotedoorlock = -1;
  108.                     };
  109.                     if (s_vehicle_remotedoorlockcode <0) then {
  110.                         s_vehicle_remotedoorlockcode = player_currentVehicle addAction  [("<t color=""#FF4000"">" + ("Lock Door") +"</t>"), "custom\vehicle_remotedoorcode.sqf",player_currentVehicle,1, true, true, "",""];
  111.                     };
  112.                 } else {
  113.                     if (s_vehicle_remotedoorlockcode != -1) then {
  114.                         player_currentVehicle removeAction s_vehicle_remotedoorlockcode;
  115.                         s_vehicle_remotedoorlockcode = -1;
  116.                     };
  117.                     if (s_vehicle_remotedoorlock <0) then {
  118.                         s_vehicle_remotedoorlock = player_currentVehicle addAction [("<t color=""#FF4000"">" + ("Lock Door") +"</t>"), "custom\vehicle_remotelockdoor.sqf","",1,true,true,"",""];
  119.                     };
  120.                 };
  121.             } else {
  122.                 player_currentVehicle removeAction s_vehicle_remotedoorlock;
  123.                 s_vehicle_remotedoorlock = -1;
  124.                 player_currentVehicle removeAction s_vehicle_remotedoorlockcode;
  125.                 s_vehicle_remotedoorlockcode = -1;
  126.             };
  127.         } else {
  128.             player_currentVehicle removeAction s_vehicle_remotedoorunlockcode;
  129.             s_vehicle_remotedoorunlockcode = -1;
  130.             player_currentVehicle removeAction s_vehicle_remotedoorunlock;
  131.             s_vehicle_remotedoorunlock = -1;
  132.             player_currentVehicle removeAction s_vehicle_remotedooropen;
  133.             s_vehicle_remotedooropen = -1;
  134.             player_currentVehicle removeAction s_vehicle_remotedoorclose;
  135.             s_vehicle_remotedoorclose = -1;
  136.             player_currentVehicle removeAction s_vehicle_remotedoorlockcode;
  137.             s_vehicle_remotedoorlockcode = -1;
  138.             player_currentVehicle removeAction s_vehicle_remotedoorlock;
  139.             s_vehicle_remotedoorlock = -1;
  140.         };
  141.     };
  142.     if (!isNull vehicle_near_GatePanel) then {
  143.         if (player_currentVehicle distance vehicle_near_GatePanel <=30 && player_currentVehicle distance vehicle_near_GatePanel >=3) then {
  144.             if (!keyValid) then {
  145.                 player_currentVehicle removeAction s_vehicle_remotegateup;
  146.                 s_vehicle_remotegateup = -1;
  147.                 player_currentVehicle removeAction s_vehicle_remotegatedown;
  148.                 s_vehicle_remotegatedown = -1;
  149.                 if (s_vehicle_enterCodeRemote < 0) then {
  150.                     s_vehicle_enterCodeRemote = player_currentVehicle addaction [("<t color=""#FF4000"">" + ("Enter Key Code to Operate Gate") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\vehicle_enterCodeRemote.sqf",vehicle_near_GatePanel,1,true,true,"",""];
  151.                 };
  152.             } else {
  153.                 player_currentVehicle removeAction s_vehicle_enterCodeRemote;
  154.                 s_vehicle_enterCodeRemote = -1;
  155.                 if (s_vehicle_remotegateup < 0) then {
  156.                     s_vehicle_remotegateup = player_currentVehicle addaction [("<t color=""#FF4000"">" + ("Operate Gate - UP") +"</t>"), "dayz_code\external\keypad\fnc_keyPad\vehicle_operate_gates_up_remote.sqf",vehicle_near_GatePanel,2,false,true,"",""];
  157.                 };
  158.                 if (s_vehicle_remotegatedown < 0) then {
  159.                     s_vehicle_remotegatedown = player_currentVehicle addaction [("<t color=""#FF4000"">" + ("Operate Gate - DOWN") +"</t>"), "dayz_code\external\keypad\fnc_keyPad\vehicle_operate_gates_down_remote.sqf",vehicle_near_GatePanel,1,false,true,"",""];
  160.                 };
  161.             };
  162.         } else {
  163.             player_currentVehicle removeAction s_vehicle_enterCodeRemote;
  164.             s_vehicle_enterCodeRemote = -1;
  165.             player_currentVehicle removeAction s_vehicle_remotegateup;
  166.             s_vehicle_remotegateup = -1;
  167.             player_currentVehicle removeAction s_vehicle_remotegatedown;
  168.             s_vehicle_remotegatedown = -1;
  169.         };
  170.     };
  171.     if ((!isNull vehicle_near_lockedDoor && vehicle_near_lockedDoor distance player_currentVehicle > 30) || (!isNull vehicle_near_GatePanel && player_currentVehicle distance vehicle_near_GatePanel > 30)) exitWith {
  172.         titleText["### Remote connection Terminated ### Distance to high! ###", "PLAIN", 3];
  173.     };
  174.     _cnt = _cnt - 1;
  175.     sleep 1;
  176. };
  177. cutText["","PLAIN",1];
  178. player_currentVehicle removeAction s_vehicle_remotedoorunlock;
  179. player_currentVehicle removeAction s_vehicle_remotedoorunlockcode;
  180. player_currentVehicle removeAction s_vehicle_remotedooropen;
  181. player_currentVehicle removeAction s_vehicle_remotedoorclose;
  182. player_currentVehicle removeAction s_vehicle_remotedoorlockcode;
  183. player_currentVehicle removeAction s_vehicle_remotedoorlock;
  184. player_currentVehicle removeAction s_vehicle_enterCodeRemote;
  185. player_currentVehicle removeAction s_vehicle_remotegateup;
  186. player_currentVehicle removeAction s_vehicle_remotegatedown;
  187. s_vehicle_remote = -1;
  188. keyValid = false;
  189. gateAccess = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement