Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 47.71 KB | None | 0 0
  1. nitroinstall.sqf=
  2. ############################################################################
  3. private ["_Vehicle","_msg","_hasnosinstalled","_scrapmetal","_toolbox"];
  4. _Vehicle = _this select 3;
  5. player removeAction s_player_nitroInstall;
  6. s_player_nitroInstall = -1;
  7.  
  8. if (dayz_combat == 1) exitWith {
  9. _msg = "You cant install the nitro boost while in combat.";
  10. cutText [_msg, "PLAIN DOWN"];
  11. };
  12.  
  13. _hasnosinstalled = _Vehicle getVariable["nitroinstalled",0];
  14. if(_hasnosinstalled == 1)exitwith{cutText ["This vehicle has already nitro installed", "PLAIN DOWN"];};
  15.  
  16. _scrapmetal = {_x == "PartGeneric"} count magazines player;
  17. _toolbox = {_x == "ItemToolbox"} count magazines player;
  18.  
  19. if ((_toolbox >= 1)&&(_scrapmetal >= 1)) then {
  20. player removeMagazine "PartGeneric";
  21. player removeMagazine "ItemToolbox";
  22. player addMagazine "ItemToolbox";
  23. _Vehicle setVariable ["nitroinstalled", 1, true];
  24. cutText ["tuning vehicle...", "PLAIN DOWN"];
  25. _Vehicle setfuel 0;
  26. r_interrupt = false;
  27. player playActionNow "Medic";
  28.  
  29. [player,"repair",0,false,10] call dayz_zombieSpeak;
  30. [player,10,true,(getPosATL player)] spawn player_alertZombies;
  31. sleep 6;
  32. _Vehicle setfuel 1;
  33. _Vehicle setVariable ["isnitroOn", 0, true];
  34. systemChat("NOS boost installed! Activate it while driving vehicle.");
  35. sleep 2;
  36. r_interrupt = false;
  37. sleep 5;
  38. cutText ["WARNING: "+name player+"! Nitro boost is only available until server restart!", "PLAIN DOWN"];
  39. } else {
  40. _msg = "You need: "+str(1 - _ItemToolbox)+"x(A Toolbox) and "+str(1 - _PartGeneric)+"x(scrap metal) to install nitro boost.";
  41. cutText [_msg, "PLAIN DOWN"];
  42. };
  43. ###############################################################################################################################
  44.  
  45.  
  46. fn_selfactions=
  47.  
  48. #################################################################################################################################
  49.  
  50. scriptName "Functions\misc\fn_selfActions.sqf";
  51. /***********************************************************
  52. ADD ACTIONS FOR SELF
  53. - Function
  54. - [] call fnc_usec_selfActions;
  55. ************************************************************/
  56. private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_isModularDoor","_ownerKeyName","_temp_keys_names","_hasAttached","_allowTow","_liftHeli","_found","_posL","_posC","_height","_liftHelis","_attached","_lightweight","_mediumweight","_heavyweight","_superheavyweight","_isaCar","_hasNOSitems","_isNOSinstalled"];
  57.  
  58. if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
  59.  
  60. _vehicle = vehicle player;
  61. _isPZombie = player isKindOf "PZombie_VB";
  62. _inVehicle = (_vehicle != player);
  63.  
  64. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  65. _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
  66. //Nos start##################################
  67.  
  68. //Nitro action
  69. _hasNOSinstalled = _vehicle getVariable["nitroinstalled",0];
  70. if (_inVehicle and _vehicle isKindOf "Car" and speed _vehicle >= 1) then {
  71. if (_inVehicle and _hasNOSinstalled == 1) then {
  72. if (isnil("NITRO_Cond")) then {NITRO_Cond = false;};
  73. if (s_player_nitrobooston <0) then {
  74. if (NITRO_Cond) then {
  75. s_player_nitrobooston = _vehicle addAction [("<t color=""#39C1F3"">" + ("Nitro Off") + "</t>"),"custom\nitro\nitro.sqf", [_vehicle], 999, false,true,"","driver _target == _this"];
  76. } else {
  77. s_player_nitrobooston = _vehicle addAction [("<t color=""#39C1F3"">" + ("Nitro On") + "</t>"),"custom\nitro\nitro.sqf", [_vehicle], 999, false,true,"","driver _target == _this"];
  78. };
  79. };
  80. } else {
  81. _vehicle removeAction s_player_nitrobooston;
  82. s_player_nitrobooston = -1;
  83. };
  84. } else {
  85. _vehicle removeAction s_player_nitrobooston;
  86. s_player_nitrobooston = -1;
  87. if (_hasNOSinstalled == 1) then {
  88. _vehicle setVariable ["nitroinstalled", 1, true];
  89. };
  90. };
  91. //nos end###############################################
  92. _nearLight = nearestObject [player,"LitObject"];
  93. _canPickLight = false;
  94. if (!isNull _nearLight) then {
  95. if (_nearLight distance player < 4) then {
  96. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  97. };
  98. };
  99.  
  100. //Grab Flare
  101. if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
  102. if (s_player_grabflare < 0) then {
  103. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  104. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  105. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  106. };
  107. } else {
  108. player removeAction s_player_grabflare;
  109. player removeAction s_player_removeflare;
  110. s_player_grabflare = -1;
  111. s_player_removeflare = -1;
  112. };
  113.  
  114. if (DZE_HeliLift) then {
  115. _hasAttached = _vehicle getVariable["hasAttached",false];
  116. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
  117. if (s_player_heli_detach < 0) then {
  118. dayz_myLiftVehicle = _vehicle;
  119. s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
  120. };
  121. } else {
  122. dayz_myLiftVehicle removeAction s_player_heli_detach;
  123. s_player_heli_detach = -1;
  124. };
  125. };
  126.  
  127. if(DZE_HaloJump) then {
  128. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
  129. if (s_halo_action < 0) then {
  130. DZE_myHaloVehicle = _vehicle;
  131. s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
  132. };
  133. } else {
  134. DZE_myHaloVehicle removeAction s_halo_action;
  135. s_halo_action = -1;
  136. };
  137. };
  138.  
  139. if (!DZE_ForceNameTagsOff) then {
  140. if (s_player_showname < 0 && !_isPZombie) then {
  141. if (DZE_ForceNameTags) then {
  142. s_player_showname = 1;
  143. player setVariable["DZE_display_name",true,true];
  144. } else {
  145. s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
  146. s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
  147. };
  148. };
  149. };
  150.  
  151. if(_isPZombie) then {
  152. if (s_player_callzombies < 0) then {
  153. s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  154. };
  155. if (DZE_PZATTACK) then {
  156. call pz_attack;
  157. DZE_PZATTACK = false;
  158. };
  159. if (s_player_pzombiesvision < 0) then {
  160. s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
  161. };
  162. if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target
  163. _isAnimal = cursorTarget isKindOf "Animal";
  164. _isZombie = cursorTarget isKindOf "zZombie_base";
  165. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  166. _isMan = cursorTarget isKindOf "Man";
  167. // Pzombie Gut human corpse || animal
  168. if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
  169. if (s_player_pzombiesfeed < 0) then {
  170. s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  171. };
  172. } else {
  173. player removeAction s_player_pzombiesfeed;
  174. s_player_pzombiesfeed = -1;
  175. };
  176. } else {
  177. player removeAction s_player_pzombiesfeed;
  178. s_player_pzombiesfeed = -1;
  179. };
  180. };
  181.  
  182. // Increase distance only if AIR || SHIP
  183. _allowedDistance = 4;
  184. _isAir = cursorTarget isKindOf "Air";
  185. _isShip = cursorTarget isKindOf "Ship";
  186. if(_isAir || _isShip) then {
  187. _allowedDistance = 8;
  188. };
  189.  
  190. if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target
  191.  
  192. // set cursortarget to variable
  193. _cursorTarget = cursorTarget;
  194.  
  195. // get typeof cursortarget once
  196. _typeOfCursorTarget = typeOf _cursorTarget;
  197.  
  198. // hintsilent _typeOfCursorTarget;
  199.  
  200. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  201. _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  202. _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
  203.  
  204. // get items && magazines only once
  205. _magazinesPlayer = magazines player;
  206.  
  207. //boiled Water
  208. _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
  209. _hastinitem = false;
  210. {
  211. if (_x in _magazinesPlayer) then {
  212. _hastinitem = true;
  213. };
  214. } count boil_tin_cans;
  215. _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;
  216. _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;
  217. _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
  218.  
  219. _itemsPlayer = items player;
  220.  
  221. _temp_keys = [];
  222. _temp_keys_names = [];
  223. // find available keys
  224. _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  225. {
  226. if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
  227. _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
  228. _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
  229. _temp_keys_names set [_ownerKeyId,_ownerKeyName];
  230. _temp_keys set [count _temp_keys,str(_ownerKeyId)];
  231. };
  232. } count _itemsPlayer;
  233.  
  234. _hasKnife = "ItemKnife" in _itemsPlayer;
  235. _hasToolbox = "ItemToolbox" in _itemsPlayer;
  236.  
  237. _isMan = _cursorTarget isKindOf "Man";
  238. _traderType = _typeOfCursorTarget;
  239. _ownerID = _cursorTarget getVariable ["CharacterID","0"];
  240. _isAnimal = _cursorTarget isKindOf "Animal";
  241. _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
  242. _isZombie = _cursorTarget isKindOf "zZombie_base";
  243. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  244. _isWreck = _typeOfCursorTarget in DZE_isWreck;
  245. _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
  246. _isModular = _cursorTarget isKindOf "ModularItems";
  247. _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
  248.  
  249. _isRemovable = _typeOfCursorTarget in DZE_isRemovable;
  250. _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
  251.  
  252. _isTent = _cursorTarget isKindOf "TentStorage";
  253.  
  254. _isAlive = alive _cursorTarget;
  255.  
  256. _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  257.  
  258. _rawmeat = meatraw;
  259. _hasRawMeat = false;
  260. {
  261. if (_x in _magazinesPlayer) then {
  262. _hasRawMeat = true;
  263. };
  264. } count _rawmeat;
  265.  
  266. _isFuel = false;
  267. if (_hasFuelE || _hasFuelBarrelE) then {
  268. {
  269. if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  270. } count dayz_fuelsources;
  271. };
  272.  
  273. // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  274.  
  275. // logic vars
  276. _player_flipveh = false;
  277. _player_deleteBuild = false;
  278. _player_lockUnlock_crtl = false;
  279.  
  280. if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
  281. if (s_player_maintain_area < 0) then {
  282. s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];
  283. s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
  284. };
  285. } else {
  286. player removeAction s_player_maintain_area;
  287. s_player_maintain_area = -1;
  288. player removeAction s_player_maintain_area_preview;
  289. s_player_maintain_area_preview = -1;
  290. };
  291.  
  292. // CURSOR TARGET ALIVE
  293. if(_isAlive) then {
  294.  
  295. //Allow player to delete objects
  296. if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
  297. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  298. _player_deleteBuild = true;
  299. };
  300. };
  301.  
  302. //Allow owners to delete modulars
  303. if(_isModular && (dayz_characterID == _ownerID)) then {
  304. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  305. _player_deleteBuild = true;
  306. };
  307. };
  308. //Allow owners to delete modular doors without locks
  309. if(_isModularDoor && (dayz_characterID == _ownerID)) then {
  310. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  311. _player_deleteBuild = true;
  312. };
  313. };
  314. // CURSOR TARGET VEHICLE
  315. if(_isVehicle) then {
  316.  
  317. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  318. if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
  319. _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
  320. if(_isVehicletype || (_playersNear >= 2)) then {
  321. _player_flipveh = true;
  322. };
  323. };
  324.  
  325.  
  326. if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
  327. _player_lockUnlock_crtl = true;
  328. };
  329.  
  330. };
  331.  
  332. };
  333.  
  334. if(_player_deleteBuild) then {
  335. if (s_player_deleteBuild < 0) then {
  336. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  337. };
  338. } else {
  339. player removeAction s_player_deleteBuild;
  340. s_player_deleteBuild = -1;
  341. };
  342.  
  343. if (DZE_HeliLift) then {
  344. _liftHeli = objNull;
  345. _found = false;
  346. _allowTow = false;
  347. if ((count (crew _cursorTarget)) == 0) then {
  348. { if(!_allowTow) then { _allowTow = _cursorTarget isKindOf _x; }; } forEach DZE_HeliAllowToTowLight;
  349. if(_allowTow) then { _lightweight = true; } else { _lightweight = false; };
  350. };
  351. if ((count (crew _cursorTarget)) == 0) then {
  352. { if(!_allowTow) then { _allowTow = _cursorTarget isKindOf _x; }; } forEach DZE_HeliAllowToTowMedium;
  353. if(_allowTow and !_lightweight) then { _mediumweight = true; } else { _mediumweight = false; };
  354. };
  355. if ((count (crew _cursorTarget)) == 0) then {
  356. { if(!_allowTow) then { _allowTow = _cursorTarget isKindOf _x; }; } forEach DZE_HeliAllowToTowHeavy;
  357. if(_allowTow and !_lightweight and !_mediumweight) then { _heavyweight = true; } else { _heavyweight = false; };
  358. };
  359. if ((count (crew _cursorTarget)) == 0) then {
  360. { if(!_allowTow) then { _allowTow = _cursorTarget isKindOf _x; }; } forEach DZE_HeliAllowToTowSuperHeavy;
  361. if(_allowTow and !_lightweight and !_mediumweight and !_heavyweight) then { _superheavyweight = true; } else { _superheavyweight = false; };
  362. };
  363. //diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow];
  364. if (_allowTow and _lightweight and !_found) then {
  365. _liftHelis = nearestObjects [player, DZE_HeliAllowTowFromLight, 15];
  366. {
  367. if(!_found) then {
  368. _posL = getPos _x;
  369. _posC = getPos _cursorTarget;
  370. _height = (_posL select 2) - (_posC select 2);
  371. _hasAttached = _x getVariable["hasAttached",false];
  372. if(_height < 15 and _height > 5 and (typeName _hasAttached != "OBJECT")) then {
  373. if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  374. _liftHeli = _x;
  375. _found = true;
  376. };
  377. };
  378. };
  379. } forEach _liftHelis;
  380. };
  381. if ( _allowTow and !_found and ( _mediumweight or _lightweight ) ) then {
  382. _liftHelis = nearestObjects [player, DZE_HeliAllowTowFromMedium, 15];
  383. {
  384. if(!_found) then {
  385. _posL = getPos _x;
  386. _posC = getPos _cursorTarget;
  387. _height = (_posL select 2) - (_posC select 2);
  388. _hasAttached = _x getVariable["hasAttached",false];
  389. if(_height < 15 and _height > 5 and (typeName _hasAttached != "OBJECT")) then {
  390. if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  391. _liftHeli = _x;
  392. _found = true;
  393. };
  394. };
  395. };
  396. } forEach _liftHelis;
  397. };
  398. if ( _allowTow and !_found and ( _heavyweight or _mediumweight or _lightweight ) ) then {
  399. _liftHelis = nearestObjects [player, DZE_HeliAllowTowFromHeavy, 15];
  400. {
  401. if(!_found) then {
  402. _posL = getPos _x;
  403. _posC = getPos _cursorTarget;
  404. _height = (_posL select 2) - (_posC select 2);
  405. _hasAttached = _x getVariable["hasAttached",false];
  406. if(_height < 15 and _height > 5 and (typeName _hasAttached != "OBJECT")) then {
  407. if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  408. _liftHeli = _x;
  409. _found = true;
  410. };
  411. };
  412. };
  413. } forEach _liftHelis;
  414. };
  415. if ( _allowTow and !_found and ( _superheavyweight or _heavyweight or _mediumweight or _lightweight ) ) then {
  416. _liftHelis = nearestObjects [player, DZE_HeliAllowTowFromSuperHeavy, 15];
  417. {
  418. if(!_found) then {
  419. _posL = getPos _x;
  420. _posC = getPos _cursorTarget;
  421. _height = (_posL select 2) - (_posC select 2);
  422. _hasAttached = _x getVariable["hasAttached",false];
  423. if(_height < 15 and _height > 5 and (typeName _hasAttached != "OBJECT")) then {
  424. if(((abs((_posL select 0) - (_posC select 0))) < 10) and ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  425. _liftHeli = _x;
  426. _found = true;
  427. };
  428. };
  429. };
  430. } forEach _liftHelis;
  431. };
  432. //diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget];
  433. _attached = _cursorTarget getVariable["attached",false];
  434. if(_found and _allowTow and _canDo and !locked _cursorTarget and !_isPZombie and (typeName _attached != "OBJECT")) then {
  435. if (s_player_heli_lift < 0) then {
  436. s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];
  437. };
  438. } else {
  439. player removeAction s_player_heli_lift;
  440. s_player_heli_lift = -1;
  441. };
  442. };
  443.  
  444. // Allow Owner to lock && unlock vehicle
  445. if(_player_lockUnlock_crtl) then {
  446. if (s_player_lockUnlock_crtl < 0) then {
  447. _hasKey = _ownerID in _temp_keys;
  448. _oldOwner = (_ownerID == dayz_playerUID);
  449. if(locked _cursorTarget) then {
  450. if(_hasKey || _oldOwner) then {
  451. _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];
  452. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  453. s_player_lockUnlock_crtl = 1;
  454. } else {
  455. if(_hasHotwireKit) then {
  456. _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
  457. } else {
  458. _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];
  459. };
  460. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  461. s_player_lockUnlock_crtl = 1;
  462. };
  463. } else {
  464. if(_hasKey || _oldOwner) then {
  465. _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
  466. s_player_lockunlock set [count s_player_lockunlock,_lock];
  467. s_player_lockUnlock_crtl = 1;
  468. };
  469. };
  470. };
  471.  
  472. } else {
  473. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  474. s_player_lockUnlock_crtl = -1;
  475. };
  476.  
  477. if(DZE_AllowForceSave) then {
  478. //Allow player to force save
  479. if((_isVehicle || _isTent) && !_isMan) then {
  480. if (s_player_forceSave < 0) then {
  481. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  482. };
  483. } else {
  484. player removeAction s_player_forceSave;
  485. s_player_forceSave = -1;
  486. };
  487. };
  488.  
  489.  
  490.  
  491. If(DZE_AllowCargoCheck) then {
  492. if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
  493. if (s_player_checkGear < 0) then {
  494. s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  495. };
  496. } else {
  497. player removeAction s_player_checkGear;
  498. s_player_checkGear = -1;
  499. };
  500. };
  501.  
  502.  
  503. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  504. if(_player_flipveh) then {
  505. if (s_player_flipveh < 0) then {
  506. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  507. };
  508. } else {
  509. player removeAction s_player_flipveh;
  510. s_player_flipveh = -1;
  511. };
  512.  
  513. //Allow player to fill jerrycan
  514. if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
  515. if (s_player_fillfuel < 0) then {
  516. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  517. };
  518. } else {
  519. player removeAction s_player_fillfuel;
  520. s_player_fillfuel = -1;
  521. };
  522.  
  523. // logic vars for addactions
  524. _player_butcher = false;
  525. _player_studybody = false;
  526. _player_SurrenderedGear = false;
  527.  
  528. // CURSOR TARGET NOT ALIVE
  529. if (!_isAlive) then {
  530.  
  531. // Gut animal/zed
  532. if((_isAnimal || _isZombie) && _hasKnife) then {
  533. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  534. if (!_isHarvested) then {
  535. _player_butcher = true;
  536. };
  537. };
  538.  
  539. // Study body
  540. if (_isMan && !_isZombie && !_isAnimal) then {
  541. _player_studybody = true;
  542. }
  543. } else {
  544. // unit alive
  545.  
  546. // gear access on surrendered player
  547. if(_isMan && !_isZombie && !_isAnimal) then {
  548. _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  549. if (_isSurrendered) then {
  550. _player_SurrenderedGear = true;
  551. };
  552. };
  553. };
  554.  
  555.  
  556. // Human Gut animal || zombie
  557. if (_player_butcher) then {
  558. if (s_player_butcher < 0) then {
  559. if(_isZombie) then {
  560. s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  561. } else {
  562. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  563. };
  564. };
  565. } else {
  566. player removeAction s_player_butcher;
  567. s_player_butcher = -1;
  568. };
  569.  
  570. // Study Body
  571. if (_player_studybody) then {
  572. if (s_player_studybody < 0) then {
  573. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
  574. };
  575. } else {
  576. player removeAction s_player_studybody;
  577. s_player_studybody = -1;
  578. };
  579.  
  580. // logic vars
  581. _player_cook = false;
  582. _player_boil = false;
  583.  
  584. // CURSOR TARGET IS FIRE
  585. if (inflamed _cursorTarget) then {
  586.  
  587. //Fireplace Actions check
  588. if (_hasRawMeat) then {
  589. _player_cook = true;
  590. };
  591.  
  592. // Boil water
  593. if (_hasbottleitem && _hastinitem) then {
  594. _player_boil = true;
  595. };
  596. };
  597.  
  598. if (_player_SurrenderedGear) then {
  599. if (s_player_SurrenderedGear < 0) then {
  600. s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
  601. };
  602. } else {
  603. player removeAction s_player_SurrenderedGear;
  604. s_player_SurrenderedGear = -1;
  605. };
  606.  
  607. //Fireplace Actions check
  608. if (_player_cook) then {
  609. if (s_player_cook < 0) then {
  610. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  611. };
  612. } else {
  613. player removeAction s_player_cook;
  614. s_player_cook = -1;
  615. };
  616.  
  617. // Boil water
  618. if (_player_boil) then {
  619. if (s_player_boil < 0) then {
  620. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  621. };
  622. } else {
  623. player removeAction s_player_boil;
  624. s_player_boil = -1;
  625. };
  626.  
  627. if(_cursorTarget == dayz_hasFire) then {
  628. if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
  629. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  630. };
  631. } else {
  632. player removeAction s_player_fireout;
  633. s_player_fireout = -1;
  634. };
  635.  
  636. //Packing my tent
  637. if(_isTent && (player distance _cursorTarget < 3)) then {
  638. if (_ownerID == dayz_characterID) then {
  639. if (s_player_packtent < 0) then {
  640. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  641. };
  642. } else {
  643. if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
  644. if (s_player_packtent < 0) then {
  645. s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  646. };
  647. };
  648. };
  649. } else {
  650. player removeAction s_player_packtent;
  651. s_player_packtent = -1;
  652. };
  653.  
  654. //Allow owner to unlock vault
  655. if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  656. if (s_player_unlockvault < 0) then {
  657. if(_typeOfCursorTarget in DZE_LockedStorage) then {
  658. if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  659. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  660. s_player_combi set [count s_player_combi,_combi];
  661. } else {
  662. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  663. s_player_combi set [count s_player_combi,_combi];
  664. };
  665. s_player_unlockvault = 1;
  666. } else {
  667. if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
  668. _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  669. s_player_combi set [count s_player_combi,_combi];
  670. s_player_unlockvault = 1;
  671. };
  672. };
  673. };
  674. } else {
  675. {player removeAction _x} count s_player_combi;s_player_combi = [];
  676. s_player_unlockvault = -1;
  677. };
  678.  
  679. //Allow owner to pack vault
  680. if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  681.  
  682. if (s_player_lockvault < 0) then {
  683. if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  684. s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  685. };
  686. };
  687. if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
  688. s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];
  689. };
  690. } else {
  691. player removeAction s_player_packvault;
  692. s_player_packvault = -1;
  693. player removeAction s_player_lockvault;
  694. s_player_lockvault = -1;
  695. };
  696.  
  697.  
  698. //Player Detain, Search, Release
  699. if (_isMan and _isAlive and !inSafeZone and !_isZombie and !_isAnimal && !(_traderType in serverTraders)) then {
  700. if (s_player_investo < 0) then {
  701. s_player_investo = player addAction [("<t color='#ffa500'>")+("Detain")+("</t>"), "custom\investigation\Detain.sqf",cursorTarget, 5, false, true, "",""];
  702. };
  703. if (s_player_investoTwo < 0) then {
  704. s_player_investoTwo = player addAction [("<t color='#ffa500'>")+("Search")+("</t>"), "custom\investigation\Search.sqf",cursorTarget, 5, false, true, "",""];
  705. };
  706. if (s_player_investoThree < 0) then {
  707. s_player_investoThree = player addAction [("<t color='#ffa500'>")+("Escort")+("</t>"), "custom\investigation\Escort.sqf",cursorTarget, 5, false, true, "",""];
  708. };
  709. if (s_player_investoFour < 0) then {
  710. s_player_investoFour = player addAction [("<t color='#ffa500'>")+("Release")+("</t>"), "custom\investigation\Release.sqf",cursorTarget, 5, false, true, "",""];
  711. };
  712. } else {
  713. player removeAction s_player_investo;
  714. s_player_investo = -1;
  715. player removeAction s_player_investoTwo;
  716. s_player_investoTwo = -1;
  717. player removeAction s_player_investoThree;
  718. s_player_investoThree = -1;
  719. player removeAction s_player_investoFour;
  720. s_player_investoFour = -1;
  721. };
  722. //Player Deaths
  723. if(_typeOfCursorTarget == "Info_Board_EP1") then {
  724. if (s_player_information < 0) then {
  725. s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  726. };
  727. } else {
  728. player removeAction s_player_information;
  729. s_player_information = -1;
  730. };
  731.  
  732. //Fuel Pump
  733. if(_typeOfCursorTarget in dayz_fuelpumparray) then {
  734. if (s_player_fuelauto < 0) then {
  735.  
  736. // check if Generator_DZ is running within 30 meters
  737. _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  738. _findNearestGen = [];
  739. {
  740. if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
  741. _findNearestGen set [(count _findNearestGen),_x];
  742. };
  743. } count _findNearestGens;
  744. _IsNearRunningGen = count (_findNearestGen);
  745.  
  746. // show that pump needs power if no generator nearby.
  747. if(_IsNearRunningGen > 0) then {
  748. s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  749. } else {
  750. s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  751. };
  752. };
  753. } else {
  754. player removeAction s_player_fuelauto;
  755. s_player_fuelauto = -1;
  756. };
  757.  
  758. //Fuel Pump on truck
  759. if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
  760. if (s_player_fuelauto2 < 0) then {
  761. // show that fuel truck pump needs power.
  762. if(isEngineOn _cursorTarget) then {
  763. s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  764. } else {
  765. s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  766. };
  767. };
  768. } else {
  769. player removeAction s_player_fuelauto2;
  770. s_player_fuelauto2 = -1;
  771. };
  772.  
  773. // inplace upgrade tool
  774. if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  775. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  776. if (s_player_upgrade_build > 0) then {
  777. player removeAction s_player_upgrade_build;
  778. s_player_upgrade_build = -1;
  779. };
  780. };
  781. if (s_player_upgrade_build < 0) then {
  782. // s_player_lastTarget = _cursorTarget;
  783. s_player_lastTarget set [0,_cursorTarget];
  784. s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
  785. };
  786. } else {
  787. player removeAction s_player_upgrade_build;
  788. s_player_upgrade_build = -1;
  789. };
  790.  
  791. // downgrade system
  792. if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
  793. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  794. if (s_player_downgrade_build > 0) then {
  795. player removeAction s_player_downgrade_build;
  796. s_player_downgrade_build = -1;
  797. };
  798. };
  799.  
  800. if (s_player_downgrade_build < 0) then {
  801. s_player_lastTarget set [1,_cursorTarget];
  802. s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
  803. };
  804. } else {
  805. player removeAction s_player_downgrade_build;
  806. s_player_downgrade_build = -1;
  807. };
  808.  
  809. // inplace maintenance tool
  810. if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
  811. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  812. if (s_player_maint_build > 0) then {
  813. player removeAction s_player_maint_build;
  814. s_player_maint_build = -1;
  815. };
  816. };
  817.  
  818. if (s_player_maint_build < 0) then {
  819. s_player_lastTarget set [2,_cursorTarget];
  820. s_player_maint_build = player addAction [format[localize "STR_EPOCH_ACTIONS_MAINTAIN",_text], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true, "",""];
  821. };
  822. } else {
  823. player removeAction s_player_maint_build;
  824. s_player_maint_build = -1;
  825. };
  826.  
  827.  
  828. //Start Generator
  829. if(_cursorTarget isKindOf "Generator_DZ") then {
  830. if (s_player_fillgen < 0) then {
  831.  
  832. // check if not running
  833. if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  834. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  835. } else {
  836. // check if not filled && player has jerry.
  837. if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  838. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  839. } else {
  840. if("ItemJerrycan" in _magazinesPlayer) then {
  841. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  842. };
  843. };
  844. };
  845. };
  846. } else {
  847. player removeAction s_player_fillgen;
  848. s_player_fillgen = -1;
  849. };
  850. //Towing with tow truck
  851. /*
  852. if(_typeOfCursorTarget == "TOW_DZE") then {
  853. if (s_player_towing < 0) then {
  854. //if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  855. //s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  856. } else {
  857. //s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  858. };
  859. };
  860. } else {
  861. player removeAction s_player_towing;
  862. s_player_towing = -1;
  863. };
  864. */
  865. //Sleep
  866. if(_isTent && _ownerID == dayz_characterID) then {
  867. if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
  868. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  869. };
  870. } else {
  871. player removeAction s_player_sleep;
  872. s_player_sleep = -1;
  873. if (_isMan && !_isAlive && !_isAnimal) then {
  874. if (s_player_clothes < 0) then {
  875. s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "custom\takeclothes.sqf",cursorTarget, -10, false, true];
  876. };
  877. } else {
  878. player removeAction s_player_clothes;
  879. s_player_clothes = -1;
  880. };
  881. };
  882.  
  883. //Repairing Vehicles
  884. if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
  885. if (s_player_repair_crtl < 0) then {
  886. dayz_myCursorTarget = _cursorTarget;
  887. _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  888. _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  889. s_player_repairActions set [count s_player_repairActions,_menu];
  890. s_player_repairActions set [count s_player_repairActions,_menu1];
  891. s_player_repair_crtl = 1;
  892. } else {
  893. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  894. s_player_repair_crtl = -1;
  895. };
  896. };
  897.  
  898. // All Traders
  899. if (_isMan && !_isPZombie && _traderType in serverTraders) then {
  900.  
  901. if (s_player_parts_crtl < 0) then {
  902.  
  903. // get humanity
  904. _humanity = player getVariable ["humanity",0];
  905. _traderMenu = call compile format["menu_%1;",_traderType];
  906.  
  907. // diag_log ("TRADER = " + str(_traderMenu));
  908.  
  909. _low_high = "low";
  910. _humanity_logic = false;
  911. if((_traderMenu select 2) == "friendly") then {
  912. _humanity_logic = (_humanity < -5000);
  913. };
  914. if((_traderMenu select 2) == "hostile") then {
  915. _low_high = "high";
  916. _humanity_logic = (_humanity > -5000);
  917. };
  918. if((_traderMenu select 2) == "hero") then {
  919. _humanity_logic = (_humanity < 5000);
  920. };
  921. if(_humanity_logic) then {
  922. _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  923. s_player_parts set [count s_player_parts,_cancel];
  924. } else {
  925.  
  926. // Static Menu
  927. {
  928. //diag_log format["DEBUG TRADER: %1", _x];
  929. _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""];
  930. s_player_parts set [count s_player_parts,_buy];
  931.  
  932. } count (_traderMenu select 1);
  933. // Database menu
  934. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
  935. s_player_parts set [count s_player_parts,_buy];
  936.  
  937. };
  938. s_player_parts_crtl = 1;
  939.  
  940. };
  941. } else {
  942. {player removeAction _x} count s_player_parts;s_player_parts = [];
  943. s_player_parts_crtl = -1;
  944. };
  945. //nos start###################################################
  946. //Nitro
  947. _isaCar = _cursorTarget isKindOf "Car";
  948. if (("ItemToolbox" in _magazinesPlayer) && ("PartGeneric" in _magazinesPlayer)) then {
  949. _hasNOSitems = true;
  950. } else {
  951. _hasNOSitems = false;
  952. };
  953. _isNOSinstalled = _cursorTarget getVariable ["nitroinstalled", 0];
  954. if (_isaCar and !locked _cursorTarget and _hasNOSitems and _isNOSinstalled == 0) then {
  955. if (s_player_nitroInstall < 0) then {
  956. s_player_nitroInstall = player addAction [("<t color=""#39C1F3"">" + ("Install NOS boost") +"</t>"), "custom\nitro\nitroinstall.sqf",_cursorTarget, 999, true, false, "",""];
  957. };
  958. } else {
  959. player removeAction s_player_nitroInstall;
  960. s_player_nitroInstall = -1;
  961. };
  962. //nos end#################################################################
  963.  
  964. if(dayz_tameDogs) then {
  965.  
  966. //Dog
  967. if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {
  968. if (s_player_tamedog < 0) then {
  969. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  970. };
  971. } else {
  972. player removeAction s_player_tamedog;
  973. s_player_tamedog = -1;
  974. };
  975. if (_isDog && _ownerID == dayz_characterID && _isAlive) then {
  976. _dogHandle = player getVariable ["dogID", 0];
  977. if (s_player_feeddog < 0 && _hasRawMeat) then {
  978. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  979. };
  980. if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
  981. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  982. };
  983. if (s_player_staydog < 0) then {
  984. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  985. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  986. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  987. };
  988. if (s_player_trackdog < 0) then {
  989. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  990. };
  991. if (s_player_barkdog < 0) then {
  992. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  993. };
  994. if (s_player_warndog < 0) then {
  995. _warn = _dogHandle getFSMVariable "_watchDog";
  996. if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  997. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  998. };
  999. if (s_player_followdog < 0) then {
  1000. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  1001. };
  1002. } else {
  1003. player removeAction s_player_feeddog;
  1004. s_player_feeddog = -1;
  1005. player removeAction s_player_waterdog;
  1006. s_player_waterdog = -1;
  1007. player removeAction s_player_staydog;
  1008. s_player_staydog = -1;
  1009. player removeAction s_player_trackdog;
  1010. s_player_trackdog = -1;
  1011. player removeAction s_player_barkdog;
  1012. s_player_barkdog = -1;
  1013. player removeAction s_player_warndog;
  1014. s_player_warndog = -1;
  1015. player removeAction s_player_followdog;
  1016. s_player_followdog = -1;
  1017. };
  1018. };
  1019.  
  1020. } else {
  1021. //Engineering
  1022. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  1023. s_player_repair_crtl = -1;
  1024.  
  1025. {player removeAction _x} count s_player_combi;s_player_combi = [];
  1026.  
  1027. dayz_myCursorTarget = objNull;
  1028. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  1029.  
  1030. {player removeAction _x} count s_player_parts;s_player_parts = [];
  1031. s_player_parts_crtl = -1;
  1032.  
  1033. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  1034. s_player_lockUnlock_crtl = -1;
  1035.  
  1036. player removeAction s_player_checkGear;
  1037. s_player_checkGear = -1;
  1038.  
  1039. player removeAction s_player_SurrenderedGear;
  1040. s_player_SurrenderedGear = -1;
  1041.  
  1042. //Others
  1043. player removeAction s_player_forceSave;
  1044. s_player_forceSave = -1;
  1045. player removeAction s_player_flipveh;
  1046. s_player_flipveh = -1;
  1047. player removeAction s_player_sleep;
  1048. s_player_sleep = -1;
  1049. player removeAction s_player_deleteBuild;
  1050. s_player_deleteBuild = -1;
  1051. player removeAction s_player_butcher;
  1052. s_player_butcher = -1;
  1053. player removeAction s_player_cook;
  1054. s_player_cook = -1;
  1055. player removeAction s_player_boil;
  1056. s_player_boil = -1;
  1057. player removeAction s_player_fireout;
  1058. s_player_fireout = -1;
  1059. player removeAction s_player_packtent;
  1060. s_player_packtent = -1;
  1061. player removeAction s_player_fillfuel;
  1062. s_player_fillfuel = -1;
  1063. player removeAction s_player_studybody;
  1064. s_player_studybody = -1;
  1065. //Dog
  1066. player removeAction s_player_tamedog;
  1067. s_player_tamedog = -1;
  1068. player removeAction s_player_feeddog;
  1069. s_player_feeddog = -1;
  1070. player removeAction s_player_waterdog;
  1071. s_player_waterdog = -1;
  1072. player removeAction s_player_staydog;
  1073. s_player_staydog = -1;
  1074. player removeAction s_player_trackdog;
  1075. s_player_trackdog = -1;
  1076. player removeAction s_player_barkdog;
  1077. s_player_barkdog = -1;
  1078. player removeAction s_player_warndog;
  1079. s_player_warndog = -1;
  1080. player removeAction s_player_followdog;
  1081. s_player_followdog = -1;
  1082.  
  1083. // vault
  1084. player removeAction s_player_unlockvault;
  1085. s_player_unlockvault = -1;
  1086. player removeAction s_player_packvault;
  1087. s_player_packvault = -1;
  1088. player removeAction s_player_lockvault;
  1089. s_player_lockvault = -1;
  1090.  
  1091. player removeAction s_player_information;
  1092. s_player_information = -1;
  1093. player removeAction s_player_investo;
  1094. s_player_investo = -1;
  1095. player removeAction s_player_investoTwo;
  1096. s_player_investoTwo = -1;
  1097. player removeAction s_player_investoThree;
  1098. s_player_investoThree = -1;
  1099. player removeAction s_player_investoFour;
  1100. s_player_investoFour = -1;
  1101. player removeAction s_player_fillgen;
  1102. s_player_fillgen = -1;
  1103. player removeAction s_player_upgrade_build;
  1104. s_player_upgrade_build = -1;
  1105. player removeAction s_player_maint_build;
  1106. s_player_maint_build = -1;
  1107. player removeAction s_player_downgrade_build;
  1108. s_player_downgrade_build = -1;
  1109. player removeAction s_player_towing;
  1110. s_player_towing = -1;
  1111. player removeAction s_player_fuelauto;
  1112. s_player_fuelauto = -1;
  1113. player removeAction s_player_fuelauto2;
  1114. s_player_fuelauto2 = -1;
  1115. };
  1116.  
  1117.  
  1118.  
  1119. //Dog actions on player self
  1120. _dogHandle = player getVariable ["dogID", 0];
  1121. if (_dogHandle > 0) then {
  1122. _dog = _dogHandle getFSMVariable "_dog";
  1123. _ownerID = "0";
  1124. if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
  1125. if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
  1126. if (s_player_movedog < 0) then {
  1127. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  1128. };
  1129. if (s_player_speeddog < 0) then {
  1130. _text = (localize "str_epoch_player_249");
  1131. _speed = 0;
  1132. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
  1133. s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID", 0],_speed], 0, false, true, "", ""];
  1134. };
  1135. if (s_player_calldog < 0) then {
  1136. s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID", 0], true], 2, false, true, "", ""];
  1137. };
  1138. };
  1139. } else {
  1140. player removeAction s_player_movedog;
  1141. s_player_movedog = -1;
  1142. player removeAction s_player_speeddog;
  1143. s_player_speeddog = -1;
  1144. player removeAction s_player_calldog;
  1145. s_player_calldog = -1;
  1146. };
  1147. ###############################################################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement