Advertisement
Guest User

fn

a guest
Apr 27th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.63 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","_hasNOSinstalled","_isaCar","_isNOSinstalled","_hasNOSitems","_playerUID"];
  8.  
  9.  
  10. if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.
  11.  
  12. _vehicle = vehicle player;
  13. _isPZombie = player isKindOf "PZombie_VB";
  14. _inVehicle = (_vehicle != player);
  15.  
  16. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  17. _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
  18. if(NOSScript)then{
  19. //Nitro action
  20. _hasNOSinstalled = _vehicle getVariable["nitroinstalled",0];
  21. if (_inVehicle and _vehicle isKindOf "Car" and speed _vehicle >= 1) then {
  22. if (_inVehicle and _hasNOSinstalled == 1) then {
  23. if (isnil("NITRO_Cond")) then {NITRO_Cond = false;};
  24. if (s_player_nitrobooston <0) then {
  25. if (NITRO_Cond) then {
  26. s_player_nitrobooston = _vehicle addAction [("<t color=""#39C1F3"">" + ("Nitro Off") + "</t>"),"scripts\NOS\nitro.sqf", [_vehicle], 999, false,true,"","driver _target == _this"];
  27. } else {
  28. s_player_nitrobooston = _vehicle addAction [("<t color=""#39C1F3"">" + ("Nitro On") + "</t>"),"scripts\NOS\nitro.sqf", [_vehicle], 999, false,true,"","driver _target == _this"];
  29. };
  30. };
  31. } else {
  32. _vehicle removeAction s_player_nitrobooston;
  33. s_player_nitrobooston = -1;
  34. };
  35. } else {
  36. _vehicle removeAction s_player_nitrobooston;
  37. s_player_nitrobooston = -1;
  38. if (_hasNOSinstalled == 1) then {
  39. _vehicle setVariable ["nitroinstalled", 1, true];
  40. };
  41. };
  42. };
  43. if(SirenScript)then{
  44. //Sirens
  45. _isCopcar = typeOf _vehicle in ["LadaLM","HMMWV_Ambulance","HMMWV_Ambulance_CZ_DES_EP1","S1203_ambulance_EP1","GAZ_Vodnik_MedEvac","policecar"];
  46.  
  47. if (_inVehicle and _isCopcar and (driver _vehicle == player)) then {
  48. dayz_addsirens = _vehicle;
  49. if (s_player_sirens_on < 0) then {
  50. s_player_sirens_on = dayz_addsirens addAction ["Sirens on","scripts\sirens\sirens_on.sqf",dayz_addsirens,2,false,true,"",""];
  51. s_player_sirens_off = dayz_addsirens addAction ["Sirens off","scripts\sirens\sirens_off.sqf",dayz_addsirens,2,false,true,"",""];
  52. };
  53. } else {
  54. dayz_addsirens removeAction s_player_sirens_on;
  55. dayz_addsirens removeAction s_player_sirens_off;
  56. s_player_sirens_on = -1;
  57. s_player_sirens_off = -1;
  58. };
  59. };
  60.  
  61. if(DeployBikeScript)then{
  62. //Deploy Bike
  63. if((speed player <= 1) && cursorTarget isKindOf "CSJ_GyroC" && _canDo) then {
  64. if (s_player_deploybike6 < 0) then {
  65. s_player_deploybike6 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack GyroCopter") +"</t>"),"scripts\spawnbike\bike6.sqf","",5,false,true,"", ""];
  66. };
  67. } else {
  68. player removeAction s_player_deploybike6;
  69. s_player_deploybike6 = -1;
  70. };
  71.  
  72. if((speed player <= 1) && cursorTarget isKindOf "TT650_Civ" && _canDo) then {
  73. if (s_player_deploybike5 < 0) then {
  74. s_player_deploybike5 = player addaction[("<t color=""#007ab7"">" + ("Upgrade to GyroCopter") +"</t>"),"scripts\spawnbike\bike5.sqf","",5,false,true,"", ""];
  75. };
  76. } else {
  77. player removeAction s_player_deploybike5;
  78. s_player_deploybike5 = -1;
  79. };
  80.  
  81. if((speed player <= 1) && cursorTarget isKindOf "TT650_Civ" && _canDo) then {
  82. if (s_player_deploybike4 < 0) then {
  83. s_player_deploybike4 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Motorcycle") +"</t>"),"scripts\spawnbike\bike4.sqf","",5,false,true,"", ""];
  84. };
  85. } else {
  86. player removeAction s_player_deploybike4;
  87. s_player_deploybike4 = -1;
  88. };
  89.  
  90. if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
  91. if (s_player_deploybike3 < 0) then {
  92. s_player_deploybike3 = player addaction[("<t color=""#007ab7"">" + ("Upgrade to Motorcycle") +"</t>"),"scripts\spawnbike\bike3.sqf","",5,false,true,"", ""];
  93. };
  94. } else {
  95. player removeAction s_player_deploybike3;
  96. s_player_deploybike3 = -1;
  97. };
  98.  
  99. if((speed player <= 1) && cursorTarget isKindOf "Old_bike_TK_CIV_EP1" && _canDo) then {
  100. if (s_player_deploybike2 < 0) then {
  101. s_player_deploybike2 = player addaction[("<t color=""#007ab7"">" + ("Re-Pack Bike") +"</t>"),"scripts\spawnbike\bike2.sqf","",5,false,true,"", ""];
  102. };
  103. } else {
  104. player removeAction s_player_deploybike2;
  105. s_player_deploybike2 = -1;
  106. };
  107. };
  108.  
  109. if(AnimatedSUVMV22)then{
  110. //animated mv22/suv hatch
  111. if (_inVehicle and (_vehicle isKindOf "MV22")) then {
  112. if (isEngineOn _vehicle) then {[_vehicle,0] call mv22_pack;};
  113. if (mv22_fold < 0) then {
  114. themv22 = _vehicle;
  115. if !(isEngineOn themv22) then {
  116. mv22_fold = themv22 addAction ["Fold","scripts\animate\mv22_fold.sqf","",5,false,true];
  117. mv22_unfold = themv22 addAction ["UnFold","scripts\animate\mv22_unfold.sqf","",5,false,true];
  118. mv22_open = themv22 addAction ["Open Ramp","scripts\animate\mv22_open.sqf","",5,false,true];
  119. mv22_close = themv22 addAction ["Close Ramp","scripts\animate\mv22_close.sqf","",5,false,true];
  120. };
  121. };
  122. if (isEngineOn themv22) then {
  123. themv22 removeAction mv22_fold;
  124. mv22_fold = -1;
  125. themv22 removeAction mv22_unfold;
  126. mv22_unfold = -1;
  127. themv22 removeAction mv22_open;
  128. mv22_open = -1;
  129. themv22 removeAction mv22_close;
  130. mv22_close = -1;
  131. };
  132. } else {
  133. themv22 removeAction mv22_fold;
  134. mv22_fold = -1;
  135. themv22 removeAction mv22_unfold;
  136. mv22_unfold = -1;
  137. themv22 removeAction mv22_open;
  138. mv22_open = -1;
  139. themv22 removeAction mv22_close;
  140. mv22_close = -1;
  141. };
  142.  
  143. if (_inVehicle and (_vehicle isKindOf "ArmoredSUV_Base_PMC")) then {
  144. if ((_vehicle animationPhase "HideGun_01") == 1) then {
  145. _unit = _vehicle turretUnit [0];
  146. if (!(isNull _unit)) then {
  147. _unit action ["moveToCargo",_vehicle,2];
  148. titleText ["\n\nYou must open the hatch first.","PLAIN DOWN"];titleFadeOut 4;
  149. };
  150. };
  151. if (suv_close < 0) then {
  152. thesuv = _vehicle;
  153. suv_close = thesuv addAction ["Close Hatch","scripts\animate\suv_close.sqf","",5,false,true];
  154. suv_open = thesuv addAction ["Open Hatch","scripts\animate\suv_open.sqf","",5,false,true];
  155. };
  156. } else {
  157. thesuv removeAction suv_close;
  158. suv_close = -1;
  159. thesuv removeAction suv_open;
  160. suv_open = -1;
  161. };
  162. };
  163.  
  164. _nearLight = nearestObject [player,"LitObject"];
  165. _canPickLight = false;
  166. if (!isNull _nearLight) then {
  167. if (_nearLight distance player < 4) then {
  168. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  169. };
  170. };
  171.  
  172. //Grab Flare
  173. if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
  174. if (s_player_grabflare < 0) then {
  175. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  176. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  177. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  178. };
  179. } else {
  180. player removeAction s_player_grabflare;
  181. player removeAction s_player_removeflare;
  182. s_player_grabflare = -1;
  183. s_player_removeflare = -1;
  184. };
  185.  
  186. if (DZE_HeliLift) then {
  187. _hasAttached = _vehicle getVariable["hasAttached",false];
  188. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
  189. if (s_player_heli_detach < 0) then {
  190. dayz_myLiftVehicle = _vehicle;
  191. s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
  192. };
  193. } else {
  194. dayz_myLiftVehicle removeAction s_player_heli_detach;
  195. s_player_heli_detach = -1;
  196. };
  197. };
  198.  
  199. if(DZE_HaloJump) then {
  200. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
  201. if (s_halo_action < 0) then {
  202. DZE_myHaloVehicle = _vehicle;
  203. s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
  204. };
  205. } else {
  206. DZE_myHaloVehicle removeAction s_halo_action;
  207. s_halo_action = -1;
  208. };
  209. };
  210.  
  211. if (!DZE_ForceNameTagsOff) then {
  212. if (s_player_showname < 0 && !_isPZombie) then {
  213. if (DZE_ForceNameTags) then {
  214. s_player_showname = 1;
  215. player setVariable["DZE_display_name",true,true];
  216. } else {
  217. s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
  218. s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
  219. };
  220. };
  221. };
  222.  
  223. if(_isPZombie) then {
  224. if (s_player_callzombies < 0) then {
  225. s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  226. };
  227. if (DZE_PZATTACK) then {
  228. call pz_attack;
  229. DZE_PZATTACK = false;
  230. };
  231. if (s_player_pzombiesvision < 0) then {
  232. 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"];
  233. };
  234. if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target
  235. _isAnimal = cursorTarget isKindOf "Animal";
  236. _isZombie = cursorTarget isKindOf "zZombie_base";
  237. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  238. _isMan = cursorTarget isKindOf "Man";
  239. // Pzombie Gut human corpse || animal
  240. if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
  241. if (s_player_pzombiesfeed < 0) then {
  242. s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  243. };
  244. } else {
  245. player removeAction s_player_pzombiesfeed;
  246. s_player_pzombiesfeed = -1;
  247. };
  248. } else {
  249. player removeAction s_player_pzombiesfeed;
  250. s_player_pzombiesfeed = -1;
  251. };
  252. };
  253.  
  254. // Increase distance only if AIR || SHIP
  255. _allowedDistance = 4;
  256. _isAir = cursorTarget isKindOf "Air";
  257. _isShip = cursorTarget isKindOf "Ship";
  258. if(_isAir || _isShip) then {
  259. _allowedDistance = 8;
  260. };
  261.  
  262. if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target
  263.  
  264. // set cursortarget to variable
  265. _cursorTarget = cursorTarget;
  266.  
  267. // get typeof cursortarget once
  268. _typeOfCursorTarget = typeOf _cursorTarget;
  269.  
  270. // hintsilent _typeOfCursorTarget;
  271.  
  272. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  273. _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  274. _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
  275.  
  276. // get items && magazines only once
  277. _magazinesPlayer = magazines player;
  278.  
  279. //boiled Water
  280. _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
  281. _hastinitem = false;
  282. {
  283. if (_x in _magazinesPlayer) then {
  284. _hastinitem = true;
  285. };
  286. } count boil_tin_cans;
  287. _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;
  288. _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;
  289. _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
  290.  
  291. _itemsPlayer = items player;
  292.  
  293. _temp_keys = [];
  294. _temp_keys_names = [];
  295. // find available keys
  296. _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  297. {
  298. if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
  299. _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
  300. _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
  301. _temp_keys_names set [_ownerKeyId,_ownerKeyName];
  302. _temp_keys set [count _temp_keys,str(_ownerKeyId)];
  303. };
  304. } count _itemsPlayer;
  305.  
  306. _hasKnife = "ItemKnife" in _itemsPlayer;
  307. _hasToolbox = "ItemToolbox" in _itemsPlayer;
  308. _hasETool = "ItemEtool" in _itemsPlayer;
  309.  
  310. _isMan = _cursorTarget isKindOf "Man";
  311. _traderType = _typeOfCursorTarget;
  312. _ownerID = _cursorTarget getVariable ["CharacterID","0"];
  313.  
  314. _isAnimal = _cursorTarget isKindOf "Animal";
  315. _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
  316. _isZombie = _cursorTarget isKindOf "zZombie_base";
  317. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  318. _isWreck = _typeOfCursorTarget in DZE_isWreck;
  319. _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
  320. //_isModular = _cursorTarget isKindOf "ModularItems";
  321. _isModular = (_cursorTarget isKindOf "ModularItems") or ((typeOf _cursorTarget) in Custom_Buildables);
  322. _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
  323.  
  324. _isRemovable = _typeOfCursorTarget in DZE_isRemovable;
  325. _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
  326.  
  327. _isTent = _cursorTarget isKindOf "TentStorage";
  328.  
  329. _isAlive = alive _cursorTarget;
  330.  
  331. _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  332.  
  333. _rawmeat = meatraw;
  334. _hasRawMeat = false;
  335. {
  336. if (_x in _magazinesPlayer) then {
  337. _hasRawMeat = true;
  338. };
  339. } count _rawmeat;
  340.  
  341. _isFuel = false;
  342. if (_hasFuelE || _hasFuelBarrelE) then {
  343. {
  344. if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  345. } count dayz_fuelsources;
  346. };
  347.  
  348. // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  349.  
  350. // logic vars
  351. _player_flipveh = false;
  352. _player_deleteBuild = false;
  353. _player_lockUnlock_crtl = false;
  354.  
  355. if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
  356. if (s_player_maintain_area < 0) then {
  357. 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];
  358. 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];
  359. };
  360. } else {
  361. player removeAction s_player_maintain_area;
  362. s_player_maintain_area = -1;
  363. player removeAction s_player_maintain_area_preview;
  364. s_player_maintain_area_preview = -1;
  365. };
  366.  
  367. // CURSOR TARGET ALIVE
  368. if(_isAlive) then {
  369.  
  370. //Allow player to delete objects
  371. if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
  372. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  373. _player_deleteBuild = true;
  374. };
  375. };
  376.  
  377. //Allow owners to delete modulars
  378. if(_isModular and (dayz_characterID == _ownerID)) then {
  379. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  380. _player_deleteBuild = true;
  381. };
  382. };
  383. //Allow owners to delete modular doors without locks
  384. if(_isModularDoor && (dayz_characterID == _ownerID)) then {
  385. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  386. _player_deleteBuild = true;
  387. };
  388. };
  389. // CURSOR TARGET VEHICLE
  390. if(_isVehicle) then {
  391.  
  392. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  393. if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 0) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
  394. if(_isVehicle) then {
  395. _player_flipveh = true;
  396. };
  397. };
  398.  
  399.  
  400. if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
  401. _player_lockUnlock_crtl = true;
  402. };
  403.  
  404. };
  405.  
  406. };
  407.  
  408.  
  409. if(_player_deleteBuild) then {
  410. if (s_player_deleteBuild < 0) then {
  411. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  412. };
  413. } else {
  414. player removeAction s_player_deleteBuild;
  415. s_player_deleteBuild = -1;
  416. };
  417.  
  418. // Allow Owner to lock && unlock vehicle
  419. if(_player_lockUnlock_crtl) then {
  420. if (s_player_lockUnlock_crtl < 0) then {
  421. _hasKey = _ownerID in _temp_keys;
  422. _oldOwner = (_ownerID == dayz_playerUID);
  423. if(locked _cursorTarget) then {
  424. if(_hasKey || _oldOwner) then {
  425. _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, "", ""];
  426. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  427. s_player_lockUnlock_crtl = 1;
  428. } else {
  429. if(_hasHotwireKit) then {
  430. _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
  431. } else {
  432. _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];
  433. };
  434. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  435. s_player_lockUnlock_crtl = 1;
  436. };
  437. } else {
  438. if(_hasKey || _oldOwner) then {
  439. _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
  440. s_player_lockunlock set [count s_player_lockunlock,_lock];
  441. s_player_lockUnlock_crtl = 1;
  442. };
  443. };
  444. };
  445.  
  446. } else {
  447. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  448. s_player_lockUnlock_crtl = -1;
  449. };
  450. if(ArrestScript)then{
  451.  
  452. _Build = canbuild;
  453. //--------------------------------------ARREST----------------------------------------------------------------
  454. if ((player getVariable"humanity") >= 5000 or (player getVariable"humanity") <= -5000 or (getPlayerUID player) in AdminList ) then {
  455. if(_isMan && !_isZombie && _canDo && _isAlive && _Build) then {
  456. if (s_player_arrest < 0) then {
  457. s_player_arrest = player addaction ['<t color="#0074E8">' + "Investigation Menu" + '</t>', "Scripts\Investigation\investigation.sqf","",100,false,true,"", ""];
  458. };
  459. } else {
  460. player removeAction s_player_arrest;
  461. s_player_arrest = -1;
  462. };
  463. };
  464. //-------------------------------------------------------------------------------------------------------------
  465. };
  466. if(DZE_AllowForceSave) then {
  467. //Allow player to force save
  468. if((_isVehicle || _isTent) && !_isMan) then {
  469. if (s_player_forceSave < 0) then {
  470. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  471. };
  472. } else {
  473. player removeAction s_player_forceSave;
  474. s_player_forceSave = -1;
  475. };
  476. };
  477.  
  478.  
  479.  
  480. If(DZE_AllowCargoCheck) then {
  481. if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
  482. if (s_player_checkGear < 0) then {
  483. s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  484. };
  485. } else {
  486. player removeAction s_player_checkGear;
  487. s_player_checkGear = -1;
  488. };
  489. };
  490.  
  491.  
  492. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  493. if(_player_flipveh) then {
  494. if (s_player_flipveh < 0) then {
  495. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "fixes\flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  496. };
  497. } else {
  498. player removeAction s_player_flipveh;
  499. s_player_flipveh = -1;
  500. };
  501.  
  502. //Allow player to fill jerrycan
  503. if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
  504. if (s_player_fillfuel < 0) then {
  505. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  506. };
  507. } else {
  508. player removeAction s_player_fillfuel;
  509. s_player_fillfuel = -1;
  510. };
  511.  
  512. // logic vars for addactions
  513. _player_butcher = false;
  514. _player_studybody = false;
  515. _player_SurrenderedGear = false;
  516.  
  517. // CURSOR TARGET NOT ALIVE
  518. if (!_isAlive) then {
  519.  
  520. // Gut animal/zed
  521. if((_isAnimal || _isZombie) && _hasKnife) then {
  522. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  523. if (!_isHarvested) then {
  524. _player_butcher = true;
  525. };
  526. };
  527.  
  528. // Study body
  529. if (_isMan && !_isZombie && !_isAnimal) then {
  530. _player_studybody = true;
  531. }
  532. } else {
  533. // unit alive
  534.  
  535. // gear access on surrendered player
  536. if(_isMan && !_isZombie && !_isAnimal) then {
  537. _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  538. if (_isSurrendered) then {
  539. _player_SurrenderedGear = true;
  540. };
  541. };
  542. };
  543.  
  544.  
  545. // Human Gut animal || zombie
  546. if (_player_butcher) then {
  547. if (s_player_butcher < 0) then {
  548. if(_isZombie) then {
  549. s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  550. } else {
  551. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  552. };
  553. };
  554. } else {
  555. player removeAction s_player_butcher;
  556. s_player_butcher = -1;
  557. };
  558.  
  559. // Study Body
  560. if (_player_studybody) then {
  561. if (s_player_studybody < 0) then {
  562. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
  563. };
  564. } else {
  565. player removeAction s_player_studybody;
  566. s_player_studybody = -1;
  567. };
  568.  
  569. //BURY BODIES
  570. if(BuryHumanScript)then{
  571. if (!_isAlive && !_isZombie && !_isAnimal && _hasETool && _isMan && _canDo) then {
  572. if (s_player_bury_human < 0) then {
  573. s_player_bury_human = player addAction [format["Bury Body"], "scripts\BuryHuman\bury_human.sqf",cursorTarget, 3, true, true, "", ""];
  574. }
  575. } else {
  576. player removeAction s_player_bury_human;
  577. s_player_bury_human = -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. if(BurnTentsScript)then{
  654. //BURN TENT
  655. if(_isTent and _hasMatches and _canDo and !_isMan) then {
  656. if (s_player_igniteTent < 0) then {
  657. s_player_igniteTent = player addAction [format["Ignite Tent"], "scripts\tent_ignite.sqf",cursorTarget, 1, true, true, "", ""];
  658. };
  659. } else {
  660. player removeAction s_player_igniteTent;
  661. s_player_igniteTent = -1;
  662. };
  663. };
  664.  
  665. //Allow owner to unlock vault
  666. if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  667. if (s_player_unlockvault < 0) then {
  668. if(_typeOfCursorTarget in DZE_LockedStorage) then {
  669. if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  670. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  671. s_player_combi set [count s_player_combi,_combi];
  672. } else {
  673. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  674. s_player_combi set [count s_player_combi,_combi];
  675. };
  676. s_player_unlockvault = 1;
  677. } else {
  678. if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
  679. _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  680. s_player_combi set [count s_player_combi,_combi];
  681. s_player_unlockvault = 1;
  682. };
  683. };
  684. };
  685. } else {
  686. {player removeAction _x} count s_player_combi;s_player_combi = [];
  687. s_player_unlockvault = -1;
  688. };
  689.  
  690. //Allow owner to pack vault
  691. if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  692.  
  693. if (s_player_lockvault < 0) then {
  694. if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  695. s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  696. };
  697. };
  698. if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
  699. 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, "",""];
  700. };
  701. } else {
  702. player removeAction s_player_packvault;
  703. s_player_packvault = -1;
  704. player removeAction s_player_lockvault;
  705. s_player_lockvault = -1;
  706. };
  707.  
  708.  
  709.  
  710. //Player Deaths
  711. if(_typeOfCursorTarget == "Info_Board_EP1") then {
  712. if (s_player_information < 0) then {
  713. s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  714. };
  715. } else {
  716. player removeAction s_player_information;
  717. s_player_information = -1;
  718. };
  719.  
  720. //Fuel Pump
  721. if(_typeOfCursorTarget in dayz_fuelpumparray) then {
  722. if (s_player_fuelauto < 0) then {
  723.  
  724. // check if Generator_DZ is running within 30 meters
  725. _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  726. _findNearestGen = [];
  727. {
  728. if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
  729. _findNearestGen set [(count _findNearestGen),_x];
  730. };
  731. } count _findNearestGens;
  732. _IsNearRunningGen = count (_findNearestGen);
  733.  
  734. // show that pump needs power if no generator nearby.
  735. if(_IsNearRunningGen > 0) then {
  736. s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  737. } else {
  738. s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  739. };
  740. };
  741. } else {
  742. player removeAction s_player_fuelauto;
  743. s_player_fuelauto = -1;
  744. };
  745.  
  746. //Fuel Pump on truck
  747. if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
  748. if (s_player_fuelauto2 < 0) then {
  749. // show that fuel truck pump needs power.
  750. if(isEngineOn _cursorTarget) then {
  751. s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  752. } else {
  753. s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  754. };
  755. };
  756. } else {
  757. player removeAction s_player_fuelauto2;
  758. s_player_fuelauto2 = -1;
  759. };
  760.  
  761. // inplace upgrade tool
  762. if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  763. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  764. if (s_player_upgrade_build > 0) then {
  765. player removeAction s_player_upgrade_build;
  766. s_player_upgrade_build = -1;
  767. };
  768. };
  769. if (s_player_upgrade_build < 0) then {
  770. // s_player_lastTarget = _cursorTarget;
  771. s_player_lastTarget set [0,_cursorTarget];
  772. s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "fixes\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
  773. };
  774. } else {
  775. player removeAction s_player_upgrade_build;
  776. s_player_upgrade_build = -1;
  777. };
  778.  
  779. // downgrade system
  780. if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
  781. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  782. if (s_player_downgrade_build > 0) then {
  783. player removeAction s_player_downgrade_build;
  784. s_player_downgrade_build = -1;
  785. };
  786. };
  787.  
  788. if (s_player_downgrade_build < 0) then {
  789. s_player_lastTarget set [1,_cursorTarget];
  790. s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "fixes\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
  791. };
  792. } else {
  793. player removeAction s_player_downgrade_build;
  794. s_player_downgrade_build = -1;
  795. };
  796.  
  797. // inplace maintenance tool
  798. if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
  799. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  800. if (s_player_maint_build > 0) then {
  801. player removeAction s_player_maint_build;
  802. s_player_maint_build = -1;
  803. };
  804. };
  805.  
  806. if (s_player_maint_build < 0) then {
  807. s_player_lastTarget set [2,_cursorTarget];
  808. 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, "",""];
  809. };
  810. } else {
  811. player removeAction s_player_maint_build;
  812. s_player_maint_build = -1;
  813. };
  814.  
  815.  
  816. //Start Generator
  817. if(_cursorTarget isKindOf "Generator_DZ") then {
  818. if (s_player_fillgen < 0) then {
  819.  
  820. // check if not running
  821. if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  822. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  823. } else {
  824. // check if not filled && player has jerry.
  825. if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  826. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  827. } else {
  828. if("ItemJerrycan" in _magazinesPlayer) then {
  829. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  830. };
  831. };
  832. };
  833. };
  834. } else {
  835. player removeAction s_player_fillgen;
  836. s_player_fillgen = -1;
  837. };
  838.  
  839. //Towing with tow truck
  840. /*
  841. if(_typeOfCursorTarget == "TOW_DZE") then {
  842. if (s_player_towing < 0) then {
  843. if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  844. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  845. } else {
  846. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  847. };
  848. };
  849. } else {
  850. player removeAction s_player_towing;
  851. s_player_towing = -1;
  852. };
  853. */
  854. if(TowingScript)then{
  855. //TOWING
  856. call compile preprocessFileLineNumbers "scripts\Towing\init.sqf";
  857. };
  858.  
  859.  
  860. if(TentHealScript)then{
  861. //Sleep
  862. if(_isTent and _ownerID == dayz_characterID) then {
  863. if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
  864. s_player_sleep = player addAction [localize "str_actions_self_sleep", "scripts\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  865. };
  866. } else {
  867. player removeAction s_player_sleep;
  868. s_player_sleep = -1;
  869. };
  870. }else{
  871. //Sleep
  872. if(_isTent && _ownerID == dayz_characterID) then {
  873. if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
  874. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  875. };
  876. } else {
  877. player removeAction s_player_sleep;
  878. s_player_sleep = -1;
  879. };
  880. };
  881.  
  882. //Repairing Vehicles
  883. if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then {
  884. _hasKey = _ownerID in _temp_keys;
  885. _oldOwner = (_ownerID == dayz_playerUID);
  886. if(!locked _cursorTarget) then {
  887. if (s_player_repair_crtl < 0) then {
  888. dayz_myCursorTarget = _cursorTarget;
  889. _menu = dayz_myCursorTarget addAction ["Repair Vehicle", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  890. _menu1 = dayz_myCursorTarget addAction ["Salvage Vehicle", "scripts\salvage\salvage.sqf",_cursorTarget, 0, true, false, "",""];;
  891. s_player_repairActions set [count s_player_repairActions,_menu];
  892. s_player_repairActions set [count s_player_repairActions,_menu1];
  893. s_player_repair_crtl = 1;
  894. } else {
  895. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  896. s_player_repair_crtl = -1;
  897. };
  898. };
  899. };
  900.  
  901. // All Traders
  902. if (_isMan && !_isPZombie && _traderType in serverTraders) then {
  903.  
  904. if (s_player_parts_crtl < 0) then {
  905.  
  906. // get humanity
  907. _humanity = player getVariable ["humanity",0];
  908. _traderMenu = call compile format["menu_%1;",_traderType];
  909.  
  910. // diag_log ("TRADER = " + str(_traderMenu));
  911.  
  912. _low_high = "low";
  913. _humanity_logic = false;
  914. if((_traderMenu select 2) == "friendly") then {
  915. _humanity_logic = (_humanity < -5000);
  916. };
  917. if((_traderMenu select 2) == "hostile") then {
  918. _low_high = "high";
  919. _humanity_logic = (_humanity > -5000);
  920. };
  921. if((_traderMenu select 2) == "hero") then {
  922. _humanity_logic = (_humanity < 5000);
  923. };
  924. if(_humanity_logic) then {
  925. _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  926. s_player_parts set [count s_player_parts,_cancel];
  927. } else {
  928.  
  929. // Static Menu
  930. {
  931. //diag_log format["DEBUG TRADER: %1", _x];
  932. _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, "",""];
  933. s_player_parts set [count s_player_parts,_buy];
  934.  
  935. } count (_traderMenu select 1);
  936. //VASP
  937. LastTraderMenu = (_traderMenu select 0);
  938. // Database menu
  939. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
  940. s_player_parts set [count s_player_parts,_buy];
  941.  
  942. };
  943. s_player_parts_crtl = 1;
  944.  
  945. };
  946. } else {
  947. {player removeAction _x} count s_player_parts;s_player_parts = [];
  948. s_player_parts_crtl = -1;
  949. };
  950. if(NOSScript)then{
  951. //Nitro
  952. _isaCar = _cursorTarget isKindOf "Car";
  953. if (("ItemJerrycan" in _magazinesPlayer) && ("ItemSodaRbull" in _magazinesPlayer)) then {
  954. _hasNOSitems = true;
  955. } else {
  956. _hasNOSitems = false;
  957. };
  958. _isNOSinstalled = _cursorTarget getVariable ["nitroinstalled", 0];
  959. if (_isaCar and !locked _cursorTarget and _hasNOSitems and _isNOSinstalled == 0) then {
  960. if (s_player_nitroInstall < 0) then {
  961. s_player_nitroInstall = player addAction [("<t color=""#39C1F3"">" + ("Install NOS boost") +"</t>"), "scripts\NOS\nitroinstall.sqf",_cursorTarget, 999, true, false, "",""];
  962. };
  963. } else {
  964. player removeAction s_player_nitroInstall;
  965. s_player_nitroInstall = -1;
  966. };
  967. };
  968.  
  969. if(dayz_tameDogs) then {
  970.  
  971. //Dog
  972. if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {
  973. if (s_player_tamedog < 0) then {
  974. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  975. };
  976. } else {
  977. player removeAction s_player_tamedog;
  978. s_player_tamedog = -1;
  979. };
  980. if (_isDog && _ownerID == dayz_characterID && _isAlive) then {
  981. _dogHandle = player getVariable ["dogID", 0];
  982. if (s_player_feeddog < 0 && _hasRawMeat) then {
  983. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  984. };
  985. if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
  986. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  987. };
  988. if (s_player_staydog < 0) then {
  989. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  990. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  991. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  992. };
  993. if (s_player_trackdog < 0) then {
  994. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  995. };
  996. if (s_player_barkdog < 0) then {
  997. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  998. };
  999. if (s_player_warndog < 0) then {
  1000. _warn = _dogHandle getFSMVariable "_watchDog";
  1001. if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  1002. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  1003. };
  1004. if (s_player_followdog < 0) then {
  1005. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  1006. };
  1007. } else {
  1008. player removeAction s_player_feeddog;
  1009. s_player_feeddog = -1;
  1010. player removeAction s_player_waterdog;
  1011. s_player_waterdog = -1;
  1012. player removeAction s_player_staydog;
  1013. s_player_staydog = -1;
  1014. player removeAction s_player_trackdog;
  1015. s_player_trackdog = -1;
  1016. player removeAction s_player_barkdog;
  1017. s_player_barkdog = -1;
  1018. player removeAction s_player_warndog;
  1019. s_player_warndog = -1;
  1020. player removeAction s_player_followdog;
  1021. s_player_followdog = -1;
  1022. };
  1023. };
  1024. if(RobBankScript)then{
  1025. // Bank Robbery
  1026. _bankrobbery = cursorTarget isKindOf "Notebook";
  1027. if ((speed player <= 1) && _bankrobbery && (player distance cursorTarget < 5)) then {
  1028. if (s_player_bankrob < 0) then {
  1029. s_player_bankrob = player addAction ["Attempt to rob the bank","scripts\banks\novyBank.sqf",cursorTarget, 0, false, true, "",""];
  1030. };
  1031. } else {
  1032. player removeAction s_player_bankrob;
  1033. s_player_bankrob = -1;
  1034. };
  1035. };
  1036.  
  1037. } else {
  1038. //Engineering
  1039. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  1040. s_player_repair_crtl = -1;
  1041.  
  1042. {player removeAction _x} count s_player_combi;s_player_combi = [];
  1043.  
  1044. dayz_myCursorTarget = objNull;
  1045. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  1046.  
  1047. {player removeAction _x} count s_player_parts;s_player_parts = [];
  1048. s_player_parts_crtl = -1;
  1049.  
  1050. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  1051. s_player_lockUnlock_crtl = -1;
  1052.  
  1053. player removeAction s_player_checkGear;
  1054. s_player_checkGear = -1;
  1055.  
  1056. player removeAction s_player_SurrenderedGear;
  1057. s_player_SurrenderedGear = -1;
  1058.  
  1059. //Others
  1060. player removeAction s_player_forceSave;
  1061. s_player_forceSave = -1;
  1062. player removeAction s_player_flipveh;
  1063. s_player_flipveh = -1;
  1064. player removeAction s_player_sleep;
  1065. s_player_sleep = -1;
  1066. player removeAction s_player_deleteBuild;
  1067. s_player_deleteBuild = -1;
  1068. player removeAction s_player_butcher;
  1069. s_player_butcher = -1;
  1070. player removeAction s_player_cook;
  1071. s_player_cook = -1;
  1072. player removeAction s_player_boil;
  1073. s_player_boil = -1;
  1074. player removeAction s_player_fireout;
  1075. s_player_fireout = -1;
  1076. player removeAction s_player_packtent;
  1077. s_player_packtent = -1;
  1078. player removeAction s_player_fillfuel;
  1079. s_player_fillfuel = -1;
  1080. player removeAction s_player_studybody;
  1081. s_player_studybody = -1;
  1082. //Dog
  1083. player removeAction s_player_tamedog;
  1084. s_player_tamedog = -1;
  1085. player removeAction s_player_feeddog;
  1086. s_player_feeddog = -1;
  1087. player removeAction s_player_waterdog;
  1088. s_player_waterdog = -1;
  1089. player removeAction s_player_staydog;
  1090. s_player_staydog = -1;
  1091. player removeAction s_player_trackdog;
  1092. s_player_trackdog = -1;
  1093. player removeAction s_player_barkdog;
  1094. s_player_barkdog = -1;
  1095. player removeAction s_player_warndog;
  1096. s_player_warndog = -1;
  1097. player removeAction s_player_followdog;
  1098. s_player_followdog = -1;
  1099.  
  1100. // vault
  1101. player removeAction s_player_unlockvault;
  1102. s_player_unlockvault = -1;
  1103. player removeAction s_player_packvault;
  1104. s_player_packvault = -1;
  1105. player removeAction s_player_lockvault;
  1106. s_player_lockvault = -1;
  1107.  
  1108. player removeAction s_player_information;
  1109. s_player_information = -1;
  1110. player removeAction s_player_fillgen;
  1111. s_player_fillgen = -1;
  1112. player removeAction s_player_upgrade_build;
  1113. s_player_upgrade_build = -1;
  1114. player removeAction s_player_maint_build;
  1115. s_player_maint_build = -1;
  1116. player removeAction s_player_downgrade_build;
  1117. s_player_downgrade_build = -1;
  1118. player removeAction s_player_towing;
  1119. s_player_towing = -1;
  1120. player removeAction s_player_fuelauto;
  1121. s_player_fuelauto = -1;
  1122. player removeAction s_player_fuelauto2;
  1123. s_player_fuelauto2 = -1;
  1124. //####----####----####---- Base Building 1.3 Start ----####----####----####
  1125. player removeAction s_player_getTargetUID;
  1126. s_player_getTargetUID = -1;
  1127. player removeAction s_player_giveBaseOwnerAccess;
  1128. s_player_giveBaseOwnerAccess = -1;
  1129. player removeAction s_player_gateActions;
  1130. s_player_gateActions = -1;
  1131. player removeAction s_player_roofToggle;
  1132. s_player_roofToggle = -1;
  1133. player removeAction s_player_addGateAuthorization;
  1134. s_player_addGateAuthorization = -1;
  1135. player removeAction s_player_removeGateAuthorization;
  1136. s_player_removeGateAuthorization = -1;
  1137. player removeAction s_player_disarmBomb;
  1138. s_player_disarmBomb = -1;
  1139. player removeAction s_player_bbZombieShield_on;
  1140. s_player_bbZombieShield_on = -1;
  1141. player removeAction s_player_bbZombieShield_off;
  1142. s_player_bbZombieShield_off = -1;
  1143. player removeAction s_player_inflameBarrels;
  1144. s_player_inflameBarrels = -1;
  1145. player removeAction s_player_deflameBarrels;
  1146. s_player_deflameBarrels = -1;
  1147. player removeAction s_player_towerLightsOn;
  1148. s_player_towerLightsOn = -1;
  1149. player removeAction s_player_towerLightsOff;
  1150. s_player_towerLightsOff = -1;
  1151. player removeAction s_player_bbLightMenu;
  1152. s_player_bbLightMenu = -1;
  1153. //####----####----####---- Base Building 1.3 End ----####----####----####
  1154. player removeAction s_player_bury_human;
  1155. s_player_bury_human = -1;
  1156. //arrest
  1157. player removeAction s_player_arrest;
  1158. s_player_arrest = -1;
  1159. player removeAction s_player_release;
  1160. s_player_release = -1;
  1161. player removeAction s_player_escort;
  1162. s_player_escort = -1;
  1163. player removeAction s_player_search;
  1164. s_player_search = -1;
  1165. player removeAction s_player_butcherZ;
  1166. s_player_butcherZ = -1;
  1167. };
  1168.  
  1169.  
  1170.  
  1171. //Dog actions on player self
  1172. _dogHandle = player getVariable ["dogID", 0];
  1173. if (_dogHandle > 0) then {
  1174. _dog = _dogHandle getFSMVariable "_dog";
  1175. _ownerID = "0";
  1176. if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
  1177. if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
  1178. if (s_player_movedog < 0) then {
  1179. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  1180. };
  1181. if (s_player_speeddog < 0) then {
  1182. _text = (localize "str_epoch_player_249");
  1183. _speed = 0;
  1184. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
  1185. 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, "", ""];
  1186. };
  1187. if (s_player_calldog < 0) then {
  1188. 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, "", ""];
  1189. };
  1190. };
  1191. } else {
  1192. player removeAction s_player_movedog;
  1193. s_player_movedog = -1;
  1194. player removeAction s_player_speeddog;
  1195. s_player_speeddog = -1;
  1196. player removeAction s_player_calldog;
  1197. s_player_calldog = -1;
  1198. };
  1199. if(DrinkWaterScript)then{
  1200. // ----------------------------- / Drink water \ ----------------------
  1201. private["_playerPos","_canDrink","_isPond","_isWell","_pondPos","_objectsWell","_objectsPond","_display"];
  1202.  
  1203. _playerPos = getPosATL player;
  1204. _canDrink = count nearestObjects [_playerPos, ["Land_pumpa","Land_water_tank"], 4] > 0;
  1205. _isPond = false;
  1206. _isWell = false;
  1207. _pondPos = [];
  1208. _objectsWell = [];
  1209.  
  1210. if (!_canDrink) then {
  1211. _objectsWell = nearestObjects [_playerPos, [], 4];
  1212. {
  1213. //Check for Well
  1214. _isWell = ["_well",str(_x),false] call fnc_inString;
  1215. if (_isWell) then {_canDrink = true};
  1216. } forEach _objectsWell;
  1217. };
  1218.  
  1219. if (!_canDrink) then {
  1220. _objectsPond = nearestObjects [_playerPos, [], 50];
  1221. {
  1222. //Check for pond
  1223. _isPond = ["pond",str(_x),false] call fnc_inString;
  1224. if (_isPond) then {
  1225. _pondPos = (_x worldToModel _playerPos) select 2;
  1226. if (_pondPos < 0) then {
  1227. _canDrink = true;
  1228. };
  1229. };
  1230. } forEach _objectsPond;
  1231. };
  1232.  
  1233. if (_canDrink) then {
  1234. if (s_player_drinkWater < 0) then {
  1235. s_player_drinkWater = player addaction[("<t color=""#0000c7"">" + (localize "STR_action_drink") +"</t>"),"scripts\DrinkWater\drink_water.sqf"];
  1236. };
  1237. } else {
  1238. player removeAction s_player_drinkWater;
  1239. s_player_drinkWater = -1;
  1240. };
  1241. // ----------------------------- \ Drink water / ----------------------
  1242. };
  1243. if(AntiZombieEmitterScript)then{
  1244. // ZOMBIE SHIELD START
  1245. if (("TrashTinCan" in magazines player) && ("TrashJackDaniels" in magazines player) && ("PartEngine" in magazines player) && ("ItemJerrycan" in magazines player) && ("ItemToolbox" in items player)) then {
  1246. hasShield = true;
  1247. } else {
  1248. hasShield = false;
  1249. };
  1250. if (hasShield) then {
  1251. if (zombieShield < 0) then {
  1252. zombieShield = player addAction [("<t color=""#00c362"">" + ("Anti-Zombie Emitter") +"</t>"),"scripts\ZombieBait_Bomb_Shield\zombieshield.sqf","",5,false,true,"",""];
  1253. };
  1254. } else {
  1255. player removeAction zombieShield;
  1256. zombieShield = -1;
  1257. };
  1258. // ZOMBIE SHIELD END
  1259. };
  1260. if(ZombieBaitScript)then{
  1261. // Zombie Bait
  1262. if (("ItemBloodbag" in magazines player) && ("FoodbeefRaw" in magazines player)) then {
  1263. hasBait = true;
  1264. } else {
  1265. hasBait = false;
  1266. };
  1267. if (hasBait) then {
  1268. if (zombieBait < 0) then {
  1269. zombieBait = player addAction [("<t color=""#c30000"">" + ("Place Zombie Bait") +"</t>"),"scripts\ZombieBait_Bomb_Shield\zombiebait.sqf","",5,false,true,"",""];
  1270. };
  1271. } else {
  1272. player removeAction zombieBait;
  1273. zombieBait = -1;
  1274. };
  1275. };
  1276. if(ZombieBombScript)then{
  1277. // Exploding Zombie Bait
  1278. if ((hasBait) && ("HandGrenade_West" in magazines player)) then {
  1279. if (zombieBomb < 0) then {
  1280. zombieBomb = player addAction [("<t color=""#c30000"">" + ("Place Exploding Bait") +"</t>"),"scripts\ZombieBait_Bomb_Shield\zombiebomb.sqf","",5,false,true,"",""];
  1281. };
  1282. } else {
  1283. player removeAction zombieBomb;
  1284. zombieBomb = -1;
  1285. };
  1286. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement