Advertisement
Guest User

Untitled

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