Advertisement
Guest User

Untitled

a guest
Jun 27th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.15 KB | None | 0 0
  1. /*
  2. DayZ Base Building
  3. Made for DayZ Epoch please ask permission to use/edit/distrubute email vbawol@veteranbastards.com.
  4. */
  5. private ["_helperColor","_objectHelper","_objectHelperDir","_objectHelperPos","_canDo", "_pos", "_cnt",
  6. "_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap","_vector","_buildOffset","_vUp"];
  7.  
  8. if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
  9. DZE_ActionInProgress = true;
  10.  
  11. //snap vars -- temporary fix for errors so variables.sqf can be skipped
  12. if (isNil "snapProVariables") then {
  13. if (isNil "DZE_snapExtraRange") then {
  14. DZE_snapExtraRange = 0;
  15. };
  16. if (isNil "DZE_checkNearbyRadius") then {
  17. DZE_checkNearbyRadius = 30;
  18. };
  19. s_player_toggleSnap = -1;
  20. s_player_toggleSnapSelect = -1;
  21. s_player_toggleSnapSelectPoint=[];
  22. snapActions = -1;
  23. snapGizmos = [];
  24. snapGizmosNearby = [];
  25. snapProVariables = true; // will skip this statement from now on.
  26. };
  27. if(isNil "vectorBuildVariables") then{
  28. s_player_toggleDegree = -1;
  29. s_player_toggleDegrees=[];
  30. degreeActions = -1;
  31. s_player_toggleVector = -1;
  32. s_player_toggleVectors=[];
  33. vectorActions = -1;
  34. vectorBuildVariables = true;
  35. };
  36. // snap vars
  37.  
  38. // disallow building if too many objects are found within (30m by default) add DZE_checkNearbyRadius = 30; to your init.sqf to change
  39. _pos = [player] call FNC_GetPos;
  40. _cnt = count (_pos nearObjects ["All",DZE_checkNearbyRadius]);
  41. if (_cnt >= DZE_BuildingLimit) exitWith { //end script if too many objects nearby
  42. DZE_ActionInProgress = false;
  43. cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];
  44. };
  45.  
  46. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  47. _isWater = dayz_isSwimming;
  48. _cancel = false;
  49. _reason = "";
  50. _canBuildOnPlot = false;
  51.  
  52. _vehicle = vehicle player;
  53. _inVehicle = (_vehicle != player);
  54.  
  55. helperDetach = false;
  56. _canDo = (!r_drag_sqf and !r_player_unconscious);
  57.  
  58. DZE_Q = false;
  59. DZE_Z = false;
  60.  
  61. DZE_Q_alt = false;
  62. DZE_Z_alt = false;
  63.  
  64. DZE_Q_ctrl = false;
  65. DZE_Z_ctrl = false;
  66.  
  67. DZE_5 = false;
  68. DZE_4 = false;
  69. DZE_6 = false;
  70. DZE_F = false;
  71.  
  72. DZE_cancelBuilding = false;
  73.  
  74. DZE_updateVec = false;
  75. DZE_memDir = 0;
  76. DZE_memForBack = 0;
  77. DZE_memLeftRight = 0;
  78.  
  79. call gear_ui_init;
  80. closeDialog 1;
  81.  
  82. if (_isWater) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
  83. if (_inVehicle) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_42"), "PLAIN DOWN"];};
  84. if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
  85. if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};
  86.  
  87. _item = _this;
  88.  
  89. // Need Near Requirements
  90. _abort = false;
  91. _reason = "";
  92.  
  93. _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");
  94.  
  95. {
  96. switch(_x) do{
  97. case "fire":
  98. {
  99. _distance = 3;
  100. _isNear = {inflamed _x} count (_pos nearObjects _distance);
  101. if(_isNear == 0) then {
  102. _abort = true;
  103. _reason = "fire";
  104. };
  105. };
  106. case "workshop":
  107. {
  108. _distance = 3;
  109. _isNear = count (nearestObjects [_pos, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
  110. if(_isNear == 0) then {
  111. _abort = true;
  112. _reason = "workshop";
  113. };
  114. };
  115. case "fueltank":
  116. {
  117. _distance = 30;
  118. _isNear = count (nearestObjects [_pos, dayz_fuelsources, _distance]);
  119. if(_isNear == 0) then {
  120. _abort = true;
  121. _reason = "fuel tank";
  122. };
  123. };
  124. };
  125. } forEach _needNear;
  126.  
  127.  
  128. if(_abort) exitWith {
  129. cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
  130. DZE_ActionInProgress = false;
  131. };
  132.  
  133. _classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
  134. _classnametmp = _classname;
  135. _require = getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
  136. _text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
  137. _ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
  138.  
  139. _lockable = 0;
  140. if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
  141. _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable");
  142. };
  143.  
  144. _requireplot = DZE_requireplot;
  145. if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
  146. _requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
  147. };
  148.  
  149. _isAllowedUnderGround = 1;
  150. if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
  151. _isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
  152. };
  153.  
  154. _offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
  155. if((count _offset) <= 0) then {
  156. _offset = [0,1.5,0];
  157. };
  158.  
  159. _isPole = (_classname == "Plastic_Pole_EP1_DZ");
  160. _isLandFireDZ = (_classname == "Land_Fire_DZ");
  161.  
  162. _distance = DZE_PlotPole select 0;
  163. _needText = localize "str_epoch_player_246";
  164.  
  165. if(_isPole) then {
  166. _distance = DZE_PlotPole select 1;
  167. };
  168.  
  169. // check for near plot
  170. _findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
  171. _findNearestPole = [];
  172.  
  173. {
  174. if (alive _x) then {
  175. _findNearestPole set [(count _findNearestPole),_x];
  176. };
  177. } count _findNearestPoles;
  178.  
  179. _IsNearPlot = count (_findNearestPole);
  180.  
  181. // If item is plot pole && another one exists within 45m
  182. if(_isPole && _IsNearPlot > 0) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
  183.  
  184. if(_IsNearPlot == 0) then {
  185.  
  186. // Allow building of plot
  187. if(_requireplot == 0 || _isLandFireDZ) then {
  188. _canBuildOnPlot = true;
  189. };
  190.  
  191. } else {
  192. // Since there are plots nearby we check for ownership && then for friend status
  193.  
  194. // check nearby plots ownership && then for friend status
  195. _nearestPole = _findNearestPole select 0;
  196.  
  197. // Find owner
  198. _ownerID = _nearestPole getVariable ["CharacterID","0"];
  199.  
  200. // diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
  201.  
  202. // check if friendly to owner
  203. if(dayz_characterID == _ownerID) then { //Keep ownership
  204. // owner can build anything within his plot except other plots
  205. if(!_isPole) then {
  206. _canBuildOnPlot = true;
  207. };
  208.  
  209. } else {
  210. // disallow building plot
  211. if(!_isPole) then {
  212. _friendlies = _nearestPole getVariable ["plotfriends",[]];
  213. _fuid = [];
  214. {
  215. _friendUID = _x select 0;
  216. _fuid = _fuid + [_friendUID];
  217. } forEach _friendlies;
  218. _builder = getPlayerUID player;
  219. // check if friendly to owner
  220. if(_builder in _fuid) then {
  221. _canBuildOnPlot = true;
  222. };
  223. };
  224. };
  225. };
  226.  
  227. // _message
  228. if(!_canBuildOnPlot) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "STR_EPOCH_PLAYER_135"),_needText,_distance] , "PLAIN DOWN"]; };
  229.  
  230. _missing = "";
  231. _hasrequireditem = true;
  232. {
  233. _hastoolweapon = _x in weapons player;
  234. if(!_hastoolweapon) exitWith { _hasrequireditem = false; _missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); };
  235. } count _require;
  236.  
  237. _hasbuilditem = _this in magazines player;
  238. if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };
  239.  
  240. if (!_hasrequireditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_137"),_missing] , "PLAIN DOWN"]; };
  241. if (_hasrequireditem) then {
  242.  
  243. _location = [0,0,0];
  244. _isOk = true;
  245.  
  246. // get inital players position
  247. _location1 = [player] call FNC_GetPos;
  248. _dir = getDir player;
  249.  
  250. // if ghost preview available use that instead
  251. if (_ghost != "") then {
  252. _classname = _ghost;
  253. };
  254.  
  255. _object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
  256. //Build gizmo
  257. _objectHelper = "Sign_sphere10cm_EP1" createVehicle _location;
  258. _helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
  259. _objectHelper setobjecttexture [0,_helperColor];
  260. _objectHelper attachTo [player,_offset];
  261. _object attachTo [_objectHelper,[0,0,0]];
  262. _position = [_objectHelper] call FNC_GetPos;
  263.  
  264. _objHDiff = 0;
  265.  
  266. if (isClass (missionConfigFile >> "SnapBuilding" >> _classname)) then {
  267. ["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
  268. };
  269.  
  270. if !(_item in DZE_noRotate) then{
  271. ["","","",["Init","Init",0]] spawn build_vectors;
  272. };
  273. while {_isOk} do {
  274.  
  275. _zheightchanged = false;
  276. _zheightdirection = "";
  277. _rotate = false;
  278.  
  279. if (DZE_Q) then {
  280. DZE_Q = false;
  281. _zheightdirection = "up";
  282. _zheightchanged = true;
  283. };
  284. if (DZE_Z) then {
  285. DZE_Z = false;
  286. _zheightdirection = "down";
  287. _zheightchanged = true;
  288. };
  289. if (DZE_Q_alt) then {
  290. DZE_Q_alt = false;
  291. _zheightdirection = "up_alt";
  292. _zheightchanged = true;
  293. };
  294. if (DZE_Z_alt) then {
  295. DZE_Z_alt = false;
  296. _zheightdirection = "down_alt";
  297. _zheightchanged = true;
  298. };
  299. if (DZE_Q_ctrl) then {
  300. DZE_Q_ctrl = false;
  301. _zheightdirection = "up_ctrl";
  302. _zheightchanged = true;
  303. };
  304. if (DZE_Z_ctrl) then {
  305. DZE_Z_ctrl = false;
  306. _zheightdirection = "down_ctrl";
  307. _zheightchanged = true;
  308. };
  309. if (DZE_4) then {
  310. _rotate = true;
  311. DZE_4 = false;
  312. if(DZE_dirWithDegrees) then{
  313. DZE_memDir = DZE_memDir - DZE_curDegree;
  314. }else{
  315. DZE_memDir = DZE_memDir - 45;
  316. };
  317. };
  318. if (DZE_6) then {
  319. _rotate = true;
  320. DZE_6 = false;
  321. if(DZE_dirWithDegrees) then{
  322. DZE_memDir = DZE_memDir + DZE_curDegree;
  323. }else{
  324. DZE_memDir = DZE_memDir + 45;
  325. };
  326. };
  327.  
  328. if(DZE_updateVec) then{
  329. [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
  330. DZE_updateVec = false;
  331. };
  332.  
  333. if (DZE_F and _canDo) then {
  334. if (helperDetach) then {
  335. _objectHelper attachTo [player];
  336. DZE_memDir = DZE_memDir-(getDir player);
  337. helperDetach = false;
  338. [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
  339. } else {
  340. _objectHelperPos = getPosATL _objectHelper;
  341. detach _objectHelper;
  342. DZE_memDir = getDir _objectHelper;
  343. [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
  344. _objectHelper setPosATL _objectHelperPos;
  345. _objectHelper setVelocity [0,0,0]; //fix sliding glitch
  346. helperDetach = true;
  347. };
  348. DZE_F = false;
  349. };
  350.  
  351. if(_rotate) then {
  352. [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
  353. };
  354.  
  355. if(_zheightchanged) then {
  356. if (!helperDetach) then {
  357. detach _objectHelper;
  358. _objectHelperDir = getDir _objectHelper;
  359. };
  360.  
  361. _position = [_objectHelper] call FNC_GetPos;
  362.  
  363. if(_zheightdirection == "up") then {
  364. _position set [2,((_position select 2)+0.1)];
  365. _objHDiff = _objHDiff + 0.1;
  366. };
  367. if(_zheightdirection == "down") then {
  368. _position set [2,((_position select 2)-0.1)];
  369. _objHDiff = _objHDiff - 0.1;
  370. };
  371.  
  372. if(_zheightdirection == "up_alt") then {
  373. _position set [2,((_position select 2)+1)];
  374. _objHDiff = _objHDiff + 1;
  375. };
  376. if(_zheightdirection == "down_alt") then {
  377. _position set [2,((_position select 2)-1)];
  378. _objHDiff = _objHDiff - 1;
  379. };
  380.  
  381. if(_zheightdirection == "up_ctrl") then {
  382. _position set [2,((_position select 2)+0.01)];
  383. _objHDiff = _objHDiff + 0.01;
  384. };
  385. if(_zheightdirection == "down_ctrl") then {
  386. _position set [2,((_position select 2)-0.01)];
  387. _objHDiff = _objHDiff - 0.01;
  388. };
  389.  
  390. if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
  391. _position set [2,0];
  392. };
  393.  
  394. if (surfaceIsWater _position) then {
  395. _objectHelper setPosASL _position;
  396. } else {
  397. _objectHelper setPosATL _position;
  398. };
  399.  
  400. if (!helperDetach) then {
  401. _objectHelper attachTo [player];
  402. };
  403. [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
  404. };
  405.  
  406. sleep 0.5;
  407.  
  408. _location2 = [player] call FNC_GetPos;
  409. _objectHelperPos = [_objectHelper] call FNC_GetPos;
  410.  
  411. if(DZE_5) exitWith {
  412. _isOk = false;
  413. _position = [_object] call FNC_GetPos;
  414. detach _object;
  415. _dir = getDir _object;
  416. _vector = [(vectorDir _object),(vectorUp _object)];
  417. deleteVehicle _object;
  418. detach _objectHelper;
  419. deleteVehicle _objectHelper;
  420. };
  421.  
  422. if(_location1 distance _location2 > 10) exitWith {
  423. _isOk = false;
  424. _cancel = true;
  425. _reason = "You've moved to far away from where you started building (within 10 meters)";
  426. detach _object;
  427. deleteVehicle _object;
  428. detach _objectHelper;
  429. deleteVehicle _objectHelper;
  430. };
  431.  
  432. if(_location1 distance _objectHelperPos > 10) exitWith {
  433. _isOk = false;
  434. _cancel = true;
  435. _reason = "Object is placed to far away from where you started building (within 10 meters)";
  436. detach _object;
  437. deleteVehicle _object;
  438. detach _objectHelper;
  439. deleteVehicle _objectHelper;
  440. };
  441.  
  442. if(abs(_objHDiff) > 10) exitWith {
  443. _isOk = false;
  444. _cancel = true;
  445. _reason = "Cannot move up or down more than 10 meters";
  446. detach _object;
  447. deleteVehicle _object;
  448. detach _objectHelper;
  449. deleteVehicle _objectHelper;
  450. };
  451.  
  452. if (player getVariable["combattimeout", 0] >= time) exitWith {
  453. _isOk = false;
  454. _cancel = true;
  455. _reason = (localize "str_epoch_player_43");
  456. detach _object;
  457. deleteVehicle _object;
  458. detach _objectHelper;
  459. deleteVehicle _objectHelper;
  460. };
  461.  
  462. if (DZE_cancelBuilding) exitWith {
  463. _isOk = false;
  464. _cancel = true;
  465. _reason = "Cancelled building.";
  466. detach _object;
  467. deleteVehicle _object;
  468. detach _objectHelper;
  469. deleteVehicle _objectHelper;
  470. };
  471. };
  472.  
  473. //No building on roads unless toggled
  474. if (!DZE_BuildOnRoads) then {
  475. if (isOnRoad _position) then { _cancel = true; _reason = "Cannot build on a road."; };
  476. };
  477.  
  478. // No building in trader zones
  479. if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
  480.  
  481. if(!_cancel) then {
  482.  
  483. _classname = _classnametmp;
  484.  
  485. // Start Build
  486. _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
  487.  
  488. _tmpbuilt setdir _dir;
  489. _tmpbuilt setVariable["memDir",_dir,true];
  490.  
  491. // Get position based on object
  492. _location = _position;
  493.  
  494. if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
  495. _location set [2,0];
  496. };
  497.  
  498. _tmpbuilt setVectorDirAndUp _vector;
  499.  
  500. _buildOffset = [0,0,0];
  501. _vUp = _vector select 1;
  502. switch (_classname) do {
  503. case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
  504. };
  505.  
  506. _location = [
  507. (_location select 0) - (_buildOffset select 0),
  508. (_location select 1) - (_buildOffset select 1),
  509. (_location select 2) - (_buildOffset select 2)
  510. ];
  511.  
  512. if (surfaceIsWater _location) then {
  513. _tmpbuilt setPosASL _location;
  514. _location = ASLtoATL _location; //Database uses ATL
  515. } else {
  516. _tmpbuilt setPosATL _location;
  517. };
  518.  
  519. cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
  520.  
  521. _limit = 3;
  522.  
  523. if (DZE_StaticConstructionCount > 0) then {
  524. _limit = DZE_StaticConstructionCount;
  525. }
  526. else {
  527. if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
  528. _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
  529. };
  530. };
  531.  
  532. _isOk = true;
  533. _proceed = false;
  534. _counter = 0;
  535.  
  536. while {_isOk} do {
  537.  
  538. [10,10] call dayz_HungerThirst;
  539. player playActionNow "Medic";
  540.  
  541. _dis=20;
  542. _sfx = "repair";
  543. [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
  544. [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
  545.  
  546. r_interrupt = false;
  547. r_doLoop = true;
  548. _started = false;
  549. _finished = false;
  550.  
  551. while {r_doLoop} do {
  552. _animState = animationState player;
  553. _isMedic = ["medic",_animState] call fnc_inString;
  554. if (_isMedic) then {
  555. _started = true;
  556. };
  557. if (_started && !_isMedic) then {
  558. r_doLoop = false;
  559. _finished = true;
  560. };
  561. if (r_interrupt || (player getVariable["combattimeout", 0] >= time)) then {
  562. r_doLoop = false;
  563. };
  564. if (DZE_cancelBuilding) exitWith {
  565. r_doLoop = false;
  566. };
  567. sleep 0.1;
  568. };
  569. r_doLoop = false;
  570.  
  571.  
  572. if(!_finished) exitWith {
  573. _isOk = false;
  574. _proceed = false;
  575. };
  576.  
  577. if(_finished) then {
  578. _counter = _counter + 1;
  579. };
  580.  
  581. cutText [format[(localize "str_epoch_player_139"),_text, _counter,_limit], "PLAIN DOWN"];
  582.  
  583. if(_counter == _limit) exitWith {
  584. _isOk = false;
  585. _proceed = true;
  586. };
  587.  
  588. };
  589.  
  590. if (_proceed) then {
  591.  
  592. _num_removed = ([player,_item] call BIS_fnc_invRemove);
  593. if(_num_removed == 1) then {
  594.  
  595. cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
  596.  
  597. if (_isPole) then {
  598. [] spawn player_plotPreview;
  599. };
  600.  
  601. _tmpbuilt setVariable ["OEMPos",_location,true];
  602.  
  603. if(_lockable > 1) then {
  604.  
  605. _combinationDisplay = "";
  606.  
  607. switch (_lockable) do {
  608.  
  609. case 2: { // 2 lockbox
  610. _combination_1 = (floor(random 3)) + 100; // 100=red,101=green,102=blue
  611. _combination_2 = floor(random 10);
  612. _combination_3 = floor(random 10);
  613. _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
  614. dayz_combination = _combination;
  615. if (_combination_1 == 100) then {
  616. _combination_1_Display = "Red";
  617. };
  618. if (_combination_1 == 101) then {
  619. _combination_1_Display = "Green";
  620. };
  621. if (_combination_1 == 102) then {
  622. _combination_1_Display = "Blue";
  623. };
  624. _combinationDisplay = format["%1%2%3",_combination_1_Display,_combination_2,_combination_3];
  625. };
  626.  
  627. case 3: { // 3 combolock
  628. _combination_1 = floor(random 10);
  629. _combination_2 = floor(random 10);
  630. _combination_3 = floor(random 10);
  631. _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
  632. dayz_combination = _combination;
  633. _combinationDisplay = _combination;
  634. };
  635.  
  636. case 4: { // 4 safe
  637. _combination_1 = floor(random 10);
  638. _combination_2 = floor(random 10);
  639. _combination_3 = floor(random 10);
  640. _combination_4 = floor(random 10);
  641. _combination = format["%1%2%3%4",_combination_1,_combination_2,_combination_3,_combination_4];
  642. dayz_combination = _combination;
  643. _combinationDisplay = _combination;
  644. };
  645. };
  646.  
  647. _tmpbuilt setVariable ["CharacterID",_combination,true];
  648.  
  649.  
  650. PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_vector],_classname];
  651. publicVariableServer "PVDZE_obj_Publish";
  652.  
  653. cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];
  654.  
  655.  
  656. } else {
  657. _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
  658.  
  659. // fire?
  660. if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
  661. _tmpbuilt spawn player_fireMonitor;
  662. } else {
  663. PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_vector],_classname];
  664. publicVariableServer "PVDZE_obj_Publish";
  665. };
  666. };
  667. } else {
  668. deleteVehicle _tmpbuilt;
  669. cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
  670. };
  671.  
  672. } else {
  673. r_interrupt = false;
  674. if (vehicle player == player) then {
  675. [objNull, player, rSwitchMove,""] call RE;
  676. player playActionNow "stop";
  677. };
  678.  
  679. deleteVehicle _tmpbuilt;
  680.  
  681. cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
  682. };
  683.  
  684. } else {
  685. cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
  686. };
  687. };
  688.  
  689. DZE_ActionInProgress = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement