Advertisement
Guest User

Untitled

a guest
Apr 12th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. private ["_fnc_open_door","_gateLowered","_isBuildable","_charPos","_character","_id","_pos","_z","_nearestGates","_inMotion","_lever","_text"];
  2. _character = _this select 1;
  3. _id = _this select 2;
  4. _lever = _this select 3;
  5. _isBuildable = true;
  6. _charPos = getposATL _character;
  7. _inMotion = _lever getVariable ["inMotion",0];
  8. _lever removeAction _id;
  9. _nearestGates = nearestObjects [_lever, ["Concrete_Wall_EP1"], 35];
  10. //dayz_updateNearbyObjects = [_charPos, _isBuildable];
  11. //publicVariableServer "dayz_updateNearbyObjects";
  12. // if (isServer) then {
  13. // dayz_updateNearbyObjects call server_updateNearbyObjects;
  14. // };
  15.  
  16. //[_charPos, _isBuildable] call server_updateNearbyObjects;
  17. if (typeOf(_lever) == "Infostand_2_EP1") then {
  18. if (_inMotion == 0) then {
  19.  
  20. _lever setVariable ["inMotion", 1, true];
  21.  
  22. {
  23. //_pos = getPosATL _x; // changed from getpos
  24. //_z = _pos select 2;
  25. _gateLowered = _x getVariable ["GateLowered", false];
  26. //if (_z <= -2) then {
  27. if (_gateLowered) then {
  28. _text = getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "displayName");
  29. cutText [format["Raising the %1 \n DO NOT PRESS AGAIN UNTIL ALL WALLS ARE FINISHED",_text], "PLAIN DOWN"];
  30. _posATL = getPosATL _x;
  31. _z = _posATL select 2;
  32. _z = _z+6;
  33. _posATL set [2,_z];
  34. _x setPosATL _posATL;
  35. //_nic = [nil, _x, "per", rHideObject, false] call RE;
  36. [nil,_x,rSAY,["trap_bear_0",60]] call RE;
  37. sleep .5;
  38. [nil,_x,rSAY,["trap_bear_0",60]] call RE;
  39. _x setVariable ["GateLowered", false, true];
  40. } else {
  41. _text = getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "displayName");
  42. cutText [format["Lowering the %1 \n DO NOT PRESS AGAIN UNTIL ALL WALLS ARE FINISHED",_text], "PLAIN DOWN"];
  43. _posATL = getPosATL _x;
  44. _z = _posATL select 2;
  45. _z = _z-6;
  46. _posATL set [2,_z];
  47. _x setPosATL _posATL;
  48. [nil,_x,rSAY,["trap_bear_0",60]] call RE;
  49. _x setVariable ["GateLowered", true, true];
  50. };
  51.  
  52. sleep 1;
  53.  
  54. } foreach _nearestGates;
  55. _lever setVariable ["inMotion", 0, true];
  56. };
  57. };
  58.  
  59. _fnc_open_door = {
  60. private["_timeOut","_door","_time","_cnt","_text"];
  61. _door = _this select 0;
  62. _time = _this select 1;
  63.  
  64. _pos = getPosATL _door;
  65. _z = _pos select 2;
  66. _z = _z-6;
  67. _pos set [2,_z];
  68. _door setVariable ["inMotion", 1, true];
  69. _text = getText (configFile >> "CfgVehicles" >> (typeOf _door) >> "displayName");
  70. [nil,_door,rSAY,["trap_bear_0",60]] call RE;
  71. _door setPosATL _pos;
  72.  
  73.  
  74.  
  75. cutText [format["Lowering the %1, will raise after %2 seconds",_text,_time], "PLAIN DOWN"];
  76. sleep _time;
  77.  
  78. cutText [format["Raising the %1",_text], "PLAIN DOWN"];
  79. [nil,_door,rSAY,["trap_bear_0",60]] call RE;
  80. _pos = getPosATL _door;
  81. _z = _pos select 2;
  82. _z = _z+6;
  83. _pos set [2,_z];
  84. _door setPosATL _pos;
  85. _door setVariable ["inMotion", 0, true];
  86.  
  87. };
  88. //The Fence_corrugated_plate is now its own single gate and not tied to a panel
  89. if (typeOf(_lever) == "Fence_corrugated_plate") then
  90. {
  91. [_lever, 60] spawn _fnc_open_door;
  92. /*
  93. if (_inMotion == 0) then {
  94. _lever setVariable ["inMotion", 1, true];
  95. _pos = getPos _lever;
  96. _z = _pos select 2;
  97. if (_z <= -1) then {
  98. _text = getText (configFile >> "CfgVehicles" >> (typeOf _lever) >> "displayName");
  99. cutText [format["Raising the %1",_text], "PLAIN DOWN"];
  100. _pos set [2,0];
  101. _lever setPos _pos;
  102. [nil,_lever,rSAY,["trap_bear_0",60]] call RE;
  103. sleep .5;
  104. [nil,_lever,rSAY,["trap_bear_0",60]] call RE;
  105. } else {
  106. _text = getText (configFile >> "CfgVehicles" >> (typeOf _lever) >> "displayName");
  107. cutText [format["Lowering the %1",_text], "PLAIN DOWN"];
  108. _pos set [2,-1.4];
  109. _lever setPos _pos;
  110. [nil,_lever,rSAY,["trap_bear_0",60]] call RE;
  111. };
  112. _lever setVariable ["inMotion", 0, true];
  113. };
  114. */
  115. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement