Advertisement
Guest User

Sercanactions

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