Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.35 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 (DZE_HeliLift) then {
  41. _hasAttached = _vehicle getVariable["hasAttached",false];
  42. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
  43. if (s_player_heli_detach < 0) then {
  44. dayz_myLiftVehicle = _vehicle;
  45. s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
  46. };
  47. } else {
  48. dayz_myLiftVehicle removeAction s_player_heli_detach;
  49. s_player_heli_detach = -1;
  50. };
  51. };
  52.  
  53. if(DZE_HaloJump) then {
  54. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
  55. if (s_halo_action < 0) then {
  56. DZE_myHaloVehicle = _vehicle;
  57. s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
  58. };
  59. } else {
  60. DZE_myHaloVehicle removeAction s_halo_action;
  61. s_halo_action = -1;
  62. };
  63. };
  64.  
  65. if (!DZE_ForceNameTagsOff) then {
  66. if (s_player_showname < 0 && !_isPZombie) then {
  67. if (DZE_ForceNameTags) then {
  68. s_player_showname = 1;
  69. player setVariable["DZE_display_name",true,true];
  70. } else {
  71. s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
  72. s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
  73. };
  74. };
  75. };
  76.  
  77. if(_isPZombie) then {
  78. if (s_player_callzombies < 0) then {
  79. s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  80. };
  81. if (DZE_PZATTACK) then {
  82. call pz_attack;
  83. DZE_PZATTACK = false;
  84. };
  85. if (s_player_pzombiesvision < 0) then {
  86. 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"];
  87. };
  88. if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target
  89. _isAnimal = cursorTarget isKindOf "Animal";
  90. _isZombie = cursorTarget isKindOf "zZombie_base";
  91. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  92. _isMan = cursorTarget isKindOf "Man";
  93. // Pzombie Gut human corpse || animal
  94. if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
  95. if (s_player_pzombiesfeed < 0) then {
  96. s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  97. };
  98. } else {
  99. player removeAction s_player_pzombiesfeed;
  100. s_player_pzombiesfeed = -1;
  101. };
  102. } else {
  103. player removeAction s_player_pzombiesfeed;
  104. s_player_pzombiesfeed = -1;
  105. };
  106. };
  107.  
  108. // Increase distance only if AIR || SHIP
  109. _allowedDistance = 4;
  110. _isAir = cursorTarget isKindOf "Air";
  111. _isShip = cursorTarget isKindOf "Ship";
  112. if(_isAir || _isShip) then {
  113. _allowedDistance = 8;
  114. };
  115.  
  116. if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target
  117.  
  118. // set cursortarget to variable
  119. _cursorTarget = cursorTarget;
  120.  
  121. // get typeof cursortarget once
  122. _typeOfCursorTarget = typeOf _cursorTarget;
  123.  
  124. // hintsilent _typeOfCursorTarget;
  125.  
  126. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  127. _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  128. _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
  129.  
  130. // get items && magazines only once
  131. _magazinesPlayer = magazines player;
  132.  
  133. //boiled Water
  134. _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
  135. _hastinitem = false;
  136. {
  137. if (_x in _magazinesPlayer) then {
  138. _hastinitem = true;
  139. };
  140. } count boil_tin_cans;
  141. _hasETool = "ItemEtool" in items player;
  142. _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;
  143. _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;
  144. _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
  145.  
  146. _itemsPlayer = items player;
  147.  
  148. _temp_keys = [];
  149. _temp_keys_names = [];
  150. // find available keys
  151. _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  152. {
  153. if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
  154. _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
  155. _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
  156. _temp_keys_names set [_ownerKeyId,_ownerKeyName];
  157. _temp_keys set [count _temp_keys,str(_ownerKeyId)];
  158. };
  159. } count _itemsPlayer;
  160.  
  161. _hasKnife = "ItemKnife" in _itemsPlayer;
  162. _hasToolbox = "ItemToolbox" in _itemsPlayer;
  163.  
  164. _isMan = _cursorTarget isKindOf "Man";
  165. _traderType = _typeOfCursorTarget;
  166. _ownerID = _cursorTarget getVariable ["CharacterID","0"];
  167. _isAnimal = _cursorTarget isKindOf "Animal";
  168. _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
  169. _isZombie = _cursorTarget isKindOf "zZombie_base";
  170. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  171. _isWreck = _typeOfCursorTarget in DZE_isWreck;
  172. _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
  173. _isModular = _cursorTarget isKindOf "ModularItems";
  174. _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
  175. _nearplotPole = nearestObject [player,"Plastic_Pole_EP1_DZ"];
  176. _nearplotPoleOwner = _nearplotPole getVariable ["ownerPUID","0"];
  177. _nearplotPoleAdded = _nearplotPole getVariable ["AddedPUIDS", []];
  178. _addedPUIDS = _cursorTarget getVariable ["AddedPUIDS", []];
  179. _hasBuildRights = if (_ownerID != "0") then {((getPlayerUID player) in (_addedPUIDS));}; //Check it's not a map object/unbuilt object to avoid RPT spam then check if player has rights
  180. _hasPlayerUID = player getVariable ["PUIDtoAdd", ""];
  181. _isRemovable = _typeOfCursorTarget in DZE_isRemovable;
  182. _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
  183.  
  184. _isTent = _cursorTarget isKindOf "TentStorage";
  185.  
  186. _isAlive = alive _cursorTarget;
  187.  
  188. _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  189.  
  190. _rawmeat = meatraw;
  191. _hasRawMeat = false;
  192. {
  193. if (_x in _magazinesPlayer) then {
  194. _hasRawMeat = true;
  195. };
  196. } count _rawmeat;
  197.  
  198. _isFuel = false;
  199. if (_hasFuelE || _hasFuelBarrelE) then {
  200. {
  201. if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  202. } count dayz_fuelsources;
  203. };
  204.  
  205. // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  206.  
  207. // logic vars
  208. _player_flipveh = false;
  209. _player_deleteBuild = false;
  210. _player_lockUnlock_crtl = false;
  211.  
  212. //Let players get other player's UID when near a plot pole
  213. if (_isMan && (_nearPlotPole distance player < 5) && ((_playerUID == _nearplotPoleOwner) || (_playerUID in _nearplotPoleAdded))) then {
  214. if (s_player_get_PUID < 0) then {
  215. s_player_get_PUID = player addAction [format["<t color='#ff8000'>Get Player UID to add rights on plot pole</t>"], "SharePlotPoles\getPlayerUID.sqf", _cursorTarget, 5, false, true, "", ""];
  216. };
  217. } else {
  218. player removeAction s_player_get_PUID;
  219. s_player_get_PUID = -1;
  220. };
  221.  
  222. if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
  223. if (s_player_maintain_area < 0) then {
  224. 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];
  225. 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];
  226. };
  227. if (_hasBuildRights || _ownerID == _playerUID) then {
  228. if (_hasPlayerUID != "") then {
  229. if (s_player_add_PUID < 0) then {
  230. s_player_add_PUID = player addAction [format["<t color='#ff8000'>Give player build rights</t>"], "SharePlotPoles\addUIDtoPole.sqf", [_cursorTarget,false], 5, false, true, "", ""];
  231. };
  232. };
  233. if (count _addedPUIDS > 0) then { //Only show remove option if there is someone to remove
  234. if (s_player_remove_PUID < 0) then {
  235. s_player_remove_PUID = player addAction ["<t color='#ff0000'>Remove a player's build rights</t>", "SharePlotPoles\removeUIDfromPole.sqf", _cursorTarget, 5, false, true, "", ""];
  236. };
  237. };
  238. } else {
  239. player removeAction s_player_add_PUID;
  240. s_player_add_PUID = -1;
  241. player removeAction s_player_remove_PUID;
  242. s_player_remove_PUID = -1;
  243. };
  244. } else {
  245. player removeAction s_player_maintain_area;
  246. s_player_maintain_area = -1;
  247. player removeAction s_player_maintain_area_preview;
  248. s_player_maintain_area_preview = -1;
  249. };
  250.  
  251.  
  252. // CURSOR TARGET ALIVE
  253. if(_isAlive) then {
  254.  
  255. //Allow player to delete objects
  256. if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
  257. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  258. _player_deleteBuild = true;
  259. };
  260. };
  261.  
  262. //Allow owners to delete modulars
  263. //Allow owners and players with build rights to delete modulars
  264. _objectsPlotPole = nearestObjects [_cursorTarget, ["Plastic_Pole_EP1_DZ"], (DZE_PlotPole select 0)] select 0;
  265. _addedToBasePole = if (_isModular && (_playerUID in (_objectsPlotPole getVariable ["AddedPUIDS", []]))) then {true}else{false};
  266. if(_isModular && (_playerUID == _ownerID || _addedToBasePole)) then {
  267. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  268. // diag_log text "fn_selfactions remove: [can remove modular item]";
  269. _player_deleteBuild = true;
  270. };
  271. };
  272.  
  273. //Allow owners and players with the code to delete modular doors without locks
  274. if(_isModularDoor && (_playerUID == _ownerID || DZE_Lock_Door == _characterID)) then {
  275. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  276. _player_deleteBuild = true;
  277. };
  278. };
  279. // CURSOR TARGET VEHICLE
  280. if(_isVehicle) then {
  281.  
  282. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  283. if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
  284. _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
  285. if(_isVehicletype || (_playersNear >= 2)) then {
  286. _player_flipveh = true;
  287. };
  288. };
  289.  
  290.  
  291. if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
  292. _player_lockUnlock_crtl = true;
  293. };
  294.  
  295. };
  296.  
  297. };
  298.  
  299. if(_player_deleteBuild) then {
  300. if (s_player_deleteBuild < 0) then {
  301. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  302. };
  303. } else {
  304. player removeAction s_player_deleteBuild;
  305. s_player_deleteBuild = -1;
  306. };
  307.  
  308. if (DZE_HeliLift) then {
  309. _liftHeli = objNull;
  310. _found = false;
  311.  
  312. _allowTow = false;
  313. if ((count (crew _cursorTarget)) == 0) then {
  314. {
  315. if(!_allowTow) then {
  316. _allowTow = _cursorTarget isKindOf _x;
  317. };
  318. } count DZE_HeliAllowToTow;
  319. };
  320.  
  321. //diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow];
  322.  
  323. if (_allowTow) then {
  324. _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15];
  325. {
  326. if(!_found) then {
  327. _posL = [_x] call FNC_getPos;
  328. _posC = [_cursorTarget] call FNC_getPos;
  329. _height = (_posL select 2) - (_posC select 2);
  330. _hasAttached = _x getVariable["hasAttached",false];
  331. if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {
  332. if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  333. _liftHeli = _x;
  334. _found = true;
  335. };
  336. };
  337. };
  338. } count _liftHelis;
  339. };
  340.  
  341. //diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget];
  342.  
  343. _attached = _cursorTarget getVariable["attached",false];
  344. if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {
  345. if (s_player_heli_lift < 0) then {
  346. s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];
  347. };
  348. } else {
  349. player removeAction s_player_heli_lift;
  350. s_player_heli_lift = -1;
  351. };
  352. };
  353.  
  354. // Allow Owner to lock && unlock vehicle
  355. if(_player_lockUnlock_crtl) then {
  356. if (s_player_lockUnlock_crtl < 0) then {
  357. _hasKey = _ownerID in _temp_keys;
  358. _oldOwner = (_ownerID == dayz_playerUID);
  359. if(locked _cursorTarget) then {
  360. if(_hasKey || _oldOwner) then {
  361. _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, "", ""];
  362. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  363. s_player_lockUnlock_crtl = 1;
  364. } else {
  365. if(_hasHotwireKit) then {
  366. _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
  367. } else {
  368. _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];
  369. };
  370. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  371. s_player_lockUnlock_crtl = 1;
  372. };
  373. } else {
  374. if(_hasKey || _oldOwner) then {
  375. _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
  376. s_player_lockunlock set [count s_player_lockunlock,_lock];
  377. s_player_lockUnlock_crtl = 1;
  378. };
  379. };
  380. };
  381.  
  382. } else {
  383. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  384. s_player_lockUnlock_crtl = -1;
  385. };
  386.  
  387. if(DZE_AllowForceSave) then {
  388. //Allow player to force save
  389. if((_isVehicle || _isTent) && !_isMan) then {
  390. if (s_player_forceSave < 0) then {
  391. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  392. };
  393. } else {
  394. player removeAction s_player_forceSave;
  395. s_player_forceSave = -1;
  396. player removeAction s_player_get_PUID;
  397. s_player_get_PUID = -1;
  398. player removeAction s_player_add_PUID;
  399. s_player_add_PUID = -1;
  400. player removeAction s_player_remove_PUID;
  401. s_player_remove_PUID = -1;
  402. };
  403. };
  404.  
  405.  
  406.  
  407. If(DZE_AllowCargoCheck) then {
  408. if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
  409. if (s_player_checkGear < 0) then {
  410. s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  411. };
  412. } else {
  413. player removeAction s_player_checkGear;
  414. s_player_checkGear = -1;
  415. };
  416. };
  417.  
  418.  
  419. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  420. if(_player_flipveh) then {
  421. if (s_player_flipveh < 0) then {
  422. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  423. };
  424. } else {
  425. player removeAction s_player_flipveh;
  426. s_player_flipveh = -1;
  427. };
  428.  
  429. //Allow player to fill jerrycan
  430. if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
  431. if (s_player_fillfuel < 0) then {
  432. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  433. };
  434. } else {
  435. player removeAction s_player_fillfuel;
  436. s_player_fillfuel = -1;
  437. };
  438.  
  439. // logic vars for addactions
  440. _player_butcher = false;
  441. _player_studybody = false;
  442. _player_SurrenderedGear = false;
  443.  
  444. // CURSOR TARGET NOT ALIVE
  445. if (!_isAlive) then {
  446.  
  447. // Gut animal/zed
  448. if((_isAnimal || _isZombie) && _hasKnife) then {
  449. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  450. if (!_isHarvested) then {
  451. _player_butcher = true;
  452. };
  453. };
  454.  
  455. // Study body
  456. if (_isMan && !_isZombie && !_isAnimal) then {
  457. _player_studybody = true;
  458. }
  459. } else {
  460. // unit alive
  461.  
  462. // gear access on surrendered player
  463. if(_isMan && !_isZombie && !_isAnimal) then {
  464. _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  465. if (_isSurrendered) then {
  466. _player_SurrenderedGear = true;
  467. };
  468. };
  469. };
  470.  
  471.  
  472. // Human Gut animal || zombie
  473. if (_player_butcher) then {
  474. if (s_player_butcher < 0) then {
  475. if(_isZombie) then {
  476. s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  477. } else {
  478. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  479. };
  480. };
  481. } else {
  482. player removeAction s_player_butcher;
  483. s_player_butcher = -1;
  484. };
  485.  
  486. // Study Body
  487. if (_player_studybody) then {
  488. if (s_player_studybody < 0) then {
  489. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
  490. };
  491. } else {
  492. player removeAction s_player_studybody;
  493. s_player_studybody = -1;
  494. };
  495.  
  496. // logic vars
  497. _player_cook = false;
  498. _player_boil = false;
  499.  
  500. // CURSOR TARGET IS FIRE
  501. if (inflamed _cursorTarget) then {
  502.  
  503. //Fireplace Actions check
  504. if (_hasRawMeat) then {
  505. _player_cook = true;
  506. };
  507.  
  508. // Boil water
  509. if (_hasbottleitem && _hastinitem) then {
  510. _player_boil = true;
  511. };
  512. };
  513.  
  514. if (_player_SurrenderedGear) then {
  515. if (s_player_SurrenderedGear < 0) then {
  516. s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
  517. };
  518. } else {
  519. player removeAction s_player_SurrenderedGear;
  520. s_player_SurrenderedGear = -1;
  521. };
  522.  
  523. //Fireplace Actions check
  524. if (_player_cook) then {
  525. if (s_player_cook < 0) then {
  526. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  527. };
  528. } else {
  529. player removeAction s_player_cook;
  530. s_player_cook = -1;
  531. };
  532.  
  533. // Boil water
  534. if (_player_boil) then {
  535. if (s_player_boil < 0) then {
  536. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  537. };
  538. } else {
  539. player removeAction s_player_boil;
  540. s_player_boil = -1;
  541. };
  542.  
  543. if(_cursorTarget == dayz_hasFire) then {
  544. if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
  545. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  546. };
  547. } else {
  548. player removeAction s_player_fireout;
  549. s_player_fireout = -1;
  550. };
  551.  
  552. //Packing my tent
  553. if(_isTent && (player distance _cursorTarget < 3)) then {
  554. if (_ownerID == dayz_characterID) then {
  555. if (s_player_packtent < 0) then {
  556. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  557. };
  558. } else {
  559. if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
  560. if (s_player_packtent < 0) then {
  561. s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  562. };
  563. };
  564. };
  565. } else {
  566. player removeAction s_player_packtent;
  567. s_player_packtent = -1;
  568. };
  569.  
  570. //Allow owner to unlock vault
  571. if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  572. if (s_player_unlockvault < 0) then {
  573. if(_typeOfCursorTarget in DZE_LockedStorage) then {
  574. if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  575. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  576. s_player_combi set [count s_player_combi,_combi];
  577. } else {
  578. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  579. s_player_combi set [count s_player_combi,_combi];
  580. };
  581. s_player_unlockvault = 1;
  582. } else {
  583. if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
  584. _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  585. s_player_combi set [count s_player_combi,_combi];
  586. s_player_unlockvault = 1;
  587. };
  588. };
  589. };
  590. } else {
  591. {player removeAction _x} count s_player_combi;s_player_combi = [];
  592. s_player_unlockvault = -1;
  593. };
  594.  
  595. //Allow owner to pack vault
  596. if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
  597.  
  598. if (s_player_lockvault < 0) then {
  599. if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
  600. s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  601. };
  602. };
  603. if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
  604. 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, "",""];
  605. };
  606. } else {
  607. player removeAction s_player_packvault;
  608. s_player_packvault = -1;
  609. player removeAction s_player_lockvault;
  610. s_player_lockvault = -1;
  611. };
  612.  
  613.  
  614.  
  615. //Player Deaths
  616. if(_typeOfCursorTarget == "Info_Board_EP1") then {
  617. if (s_player_information < 0) then {
  618. s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  619. };
  620. } else {
  621. player removeAction s_player_information;
  622. s_player_information = -1;
  623. };
  624.  
  625. //Fuel Pump
  626. if(_typeOfCursorTarget in dayz_fuelpumparray) then {
  627. if (s_player_fuelauto < 0) then {
  628.  
  629. // check if Generator_DZ is running within 30 meters
  630. _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  631. _findNearestGen = [];
  632. {
  633. if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
  634. _findNearestGen set [(count _findNearestGen),_x];
  635. };
  636. } count _findNearestGens;
  637. _IsNearRunningGen = count (_findNearestGen);
  638.  
  639. // show that pump needs power if no generator nearby.
  640. if(_IsNearRunningGen > 0) then {
  641. s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  642. } else {
  643. s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  644. };
  645. };
  646. } else {
  647. player removeAction s_player_fuelauto;
  648. s_player_fuelauto = -1;
  649. };
  650.  
  651. //Fuel Pump on truck
  652. if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
  653. if (s_player_fuelauto2 < 0) then {
  654. // show that fuel truck pump needs power.
  655. if(isEngineOn _cursorTarget) then {
  656. s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  657. } else {
  658. s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  659. };
  660. };
  661. } else {
  662. player removeAction s_player_fuelauto2;
  663. s_player_fuelauto2 = -1;
  664. };
  665.  
  666. // inplace upgrade tool
  667. if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  668. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  669. if (s_player_upgrade_build > 0) then {
  670. player removeAction s_player_upgrade_build;
  671. s_player_upgrade_build = -1;
  672. };
  673. };
  674. if (s_player_upgrade_build < 0) then {
  675. // s_player_lastTarget = _cursorTarget;
  676. s_player_lastTarget set [0,_cursorTarget];
  677. s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
  678. };
  679. } else {
  680. player removeAction s_player_upgrade_build;
  681. s_player_upgrade_build = -1;
  682. };
  683.  
  684. // downgrade system
  685. if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
  686. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  687. if (s_player_downgrade_build > 0) then {
  688. player removeAction s_player_downgrade_build;
  689. s_player_downgrade_build = -1;
  690. };
  691. };
  692.  
  693. if (s_player_downgrade_build < 0) then {
  694. s_player_lastTarget set [1,_cursorTarget];
  695. s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
  696. };
  697. } else {
  698. player removeAction s_player_downgrade_build;
  699. s_player_downgrade_build = -1;
  700. };
  701.  
  702. // inplace maintenance tool
  703. if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
  704. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  705. if (s_player_maint_build > 0) then {
  706. player removeAction s_player_maint_build;
  707. s_player_maint_build = -1;
  708. };
  709. };
  710.  
  711. if (s_player_maint_build < 0) then {
  712. s_player_lastTarget set [2,_cursorTarget];
  713. 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, "",""];
  714. };
  715. } else {
  716. player removeAction s_player_maint_build;
  717. s_player_maint_build = -1;
  718. };
  719.  
  720.  
  721. //Start Generator
  722. if(_cursorTarget isKindOf "Generator_DZ") then {
  723. if (s_player_fillgen < 0) then {
  724.  
  725. // check if not running
  726. if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  727. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  728. } else {
  729. // check if not filled && player has jerry.
  730. if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  731. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  732. } else {
  733. if("ItemJerrycan" in _magazinesPlayer) then {
  734. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  735. };
  736. };
  737. };
  738. };
  739. } else {
  740. player removeAction s_player_fillgen;
  741. s_player_fillgen = -1;
  742. };
  743.  
  744. //Towing with tow truck
  745. /*
  746. if(_typeOfCursorTarget == "TOW_DZE") then {
  747. if (s_player_towing < 0) then {
  748. if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  749. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  750. } else {
  751. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  752. };
  753. };
  754. } else {
  755. player removeAction s_player_towing;
  756. s_player_towing = -1;
  757. };
  758. */
  759.  
  760.  
  761. //Sleep
  762. if(_isTent && _ownerID == dayz_characterID) then {
  763. if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
  764. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  765. };
  766. } else {
  767. player removeAction s_player_sleep;
  768. s_player_sleep = -1;
  769. };
  770. _clothesTaken = _cursorTarget getVariable["clothesTaken",false];
  771.  
  772. // Take clothes by Zabn
  773. if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {
  774. if (s_player_clothes < 0) then {
  775. s_player_clothes = player addAction [("<t color='#0096ff'>")+("Take Clothes")+("</t>"), "scripts\player_takeClothes_v2.sqf",[_cursorTarget], -10, false, true, "",""];
  776. };
  777. } else {
  778. player removeAction s_player_clothes;
  779. s_player_clothes = -1;
  780. };
  781.  
  782. //Repairing Vehicles
  783. if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
  784. if (s_player_repair_crtl < 0) then {
  785. dayz_myCursorTarget = _cursorTarget;
  786. _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  787. _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  788. s_player_repairActions set [count s_player_repairActions,_menu];
  789. s_player_repairActions set [count s_player_repairActions,_menu1];
  790. s_player_repair_crtl = 1;
  791. } else {
  792. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  793. s_player_repair_crtl = -1;
  794. };
  795. };
  796.  
  797. // All Traders
  798. if (_isMan && !_isPZombie && _traderType in serverTraders) then {
  799.  
  800. if (s_player_parts_crtl < 0) then {
  801.  
  802. // get humanity
  803. _humanity = player getVariable ["humanity",0];
  804. _traderMenu = call compile format["menu_%1;",_traderType];
  805.  
  806. // diag_log ("TRADER = " + str(_traderMenu));
  807.  
  808. _low_high = "low";
  809. _humanity_logic = false;
  810. if((_traderMenu select 2) == "friendly") then {
  811. _humanity_logic = (_humanity < -5000);
  812. };
  813. if((_traderMenu select 2) == "hostile") then {
  814. _low_high = "high";
  815. _humanity_logic = (_humanity > -5000);
  816. };
  817. if((_traderMenu select 2) == "hero") then {
  818. _humanity_logic = (_humanity < 5000);
  819. };
  820. if(_humanity_logic) then {
  821. _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  822. s_player_parts set [count s_player_parts,_cancel];
  823. } else {
  824.  
  825. // Static Menu
  826. {
  827. //diag_log format["DEBUG TRADER: %1", _x];
  828. _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, "",""];
  829. s_player_parts set [count s_player_parts,_buy];
  830.  
  831. } count (_traderMenu select 1);
  832. // Database menu
  833. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
  834. s_player_parts set [count s_player_parts,_buy];
  835.  
  836. };
  837. s_player_parts_crtl = 1;
  838.  
  839. };
  840. } else {
  841. {player removeAction _x} count s_player_parts;s_player_parts = [];
  842. s_player_parts_crtl = -1;
  843. };
  844.  
  845.  
  846. if(dayz_tameDogs) then {
  847.  
  848. //Dog
  849. if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {
  850. if (s_player_tamedog < 0) then {
  851. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  852. };
  853. } else {
  854. player removeAction s_player_tamedog;
  855. s_player_tamedog = -1;
  856. };
  857. if (_isDog && _ownerID == dayz_characterID && _isAlive) then {
  858. _dogHandle = player getVariable ["dogID", 0];
  859. if (s_player_feeddog < 0 && _hasRawMeat) then {
  860. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  861. };
  862. if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
  863. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  864. };
  865. if (s_player_staydog < 0) then {
  866. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  867. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  868. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  869. };
  870. if (s_player_trackdog < 0) then {
  871. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  872. };
  873. if (s_player_barkdog < 0) then {
  874. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  875. };
  876. if (s_player_warndog < 0) then {
  877. _warn = _dogHandle getFSMVariable "_watchDog";
  878. if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  879. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  880. };
  881. if (s_player_followdog < 0) then {
  882. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  883. };
  884. } else {
  885. player removeAction s_player_feeddog;
  886. s_player_feeddog = -1;
  887. player removeAction s_player_waterdog;
  888. s_player_waterdog = -1;
  889. player removeAction s_player_staydog;
  890. s_player_staydog = -1;
  891. player removeAction s_player_trackdog;
  892. s_player_trackdog = -1;
  893. player removeAction s_player_barkdog;
  894. s_player_barkdog = -1;
  895. player removeAction s_player_warndog;
  896. s_player_warndog = -1;
  897. player removeAction s_player_followdog;
  898. s_player_followdog = -1;
  899. };
  900. };
  901.  
  902. } else {
  903. //Engineering
  904. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  905. s_player_repair_crtl = -1;
  906.  
  907. {player removeAction _x} count s_player_combi;s_player_combi = [];
  908.  
  909. dayz_myCursorTarget = objNull;
  910. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  911.  
  912. {player removeAction _x} count s_player_parts;s_player_parts = [];
  913. s_player_parts_crtl = -1;
  914.  
  915. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  916. s_player_lockUnlock_crtl = -1;
  917.  
  918. player removeAction s_player_checkGear;
  919. s_player_checkGear = -1;
  920.  
  921. player removeAction s_player_SurrenderedGear;
  922. s_player_SurrenderedGear = -1;
  923.  
  924. //Others
  925. player removeAction s_player_forceSave;
  926. s_player_forceSave = -1;
  927. player removeAction s_player_flipveh;
  928. player removeAction s_player_bury_human;
  929. s_player_bury_human = -1;
  930. s_player_flipveh = -1;
  931. player removeAction s_player_sleep;
  932. s_player_sleep = -1;
  933. player removeAction s_player_deleteBuild;
  934. s_player_deleteBuild = -1;
  935. player removeAction s_player_butcher;
  936. s_player_butcher = -1;
  937. player removeAction s_player_cook;
  938. s_player_cook = -1;
  939. player removeAction s_player_boil;
  940. s_player_boil = -1;
  941. player removeAction s_player_fireout;
  942. s_player_fireout = -1;
  943. player removeAction s_player_packtent;
  944. s_player_packtent = -1;
  945. player removeAction s_player_fillfuel;
  946. s_player_fillfuel = -1;
  947. player removeAction s_player_studybody;
  948. s_player_studybody = -1;
  949. // Take Clothes by Zabn
  950. player removeAction s_player_clothes;
  951. s_player_clothes = -1;
  952. //Dog
  953. player removeAction s_player_tamedog;
  954. s_player_tamedog = -1;
  955. player removeAction s_player_feeddog;
  956. s_player_feeddog = -1;
  957. player removeAction s_player_waterdog;
  958. s_player_waterdog = -1;
  959. player removeAction s_player_staydog;
  960. s_player_staydog = -1;
  961. player removeAction s_player_trackdog;
  962. s_player_trackdog = -1;
  963. player removeAction s_player_barkdog;
  964. s_player_barkdog = -1;
  965. player removeAction s_player_warndog;
  966. s_player_warndog = -1;
  967. player removeAction s_player_followdog;
  968. s_player_followdog = -1;
  969.  
  970. // vault
  971. player removeAction s_player_unlockvault;
  972. s_player_unlockvault = -1;
  973. player removeAction s_player_packvault;
  974. s_player_packvault = -1;
  975. player removeAction s_player_lockvault;
  976. s_player_lockvault = -1;
  977.  
  978. player removeAction s_player_information;
  979. s_player_information = -1;
  980. player removeAction s_player_fillgen;
  981. s_player_fillgen = -1;
  982. player removeAction s_player_upgrade_build;
  983. s_player_upgrade_build = -1;
  984. player removeAction s_player_maint_build;
  985. s_player_maint_build = -1;
  986. player removeAction s_player_downgrade_build;
  987. s_player_downgrade_build = -1;
  988. player removeAction s_player_towing;
  989. s_player_towing = -1;
  990. player removeAction s_player_fuelauto;
  991. s_player_fuelauto = -1;
  992. player removeAction s_player_fuelauto2;
  993. s_player_fuelauto2 = -1;
  994. };
  995.  
  996.  
  997.  
  998. //Dog actions on player self
  999. _dogHandle = player getVariable ["dogID", 0];
  1000. if (_dogHandle > 0) then {
  1001. _dog = _dogHandle getFSMVariable "_dog";
  1002. _ownerID = "0";
  1003. if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
  1004. if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
  1005. if (s_player_movedog < 0) then {
  1006. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  1007. };
  1008. if (s_player_speeddog < 0) then {
  1009. _text = (localize "str_epoch_player_249");
  1010. _speed = 0;
  1011. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
  1012. 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, "", ""];
  1013. };
  1014. if (s_player_calldog < 0) then {
  1015. 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, "", ""];
  1016. };
  1017. };
  1018. } else {
  1019. player removeAction s_player_movedog;
  1020. s_player_movedog = -1;
  1021. player removeAction s_player_speeddog;
  1022. s_player_speeddog = -1;
  1023. player removeAction s_player_calldog;
  1024. s_player_calldog = -1;
  1025. };
  1026. // ------------------------------------------------------------------------Krixes Self Bloodbag Start------------------------------------------------------------------------
  1027. _mags = magazines player;
  1028.  
  1029. // Krixes Self Bloodbag
  1030. if ("ItemBloodbag" in _mags) then {
  1031. hasBagItem = true;
  1032. } else { hasBagItem = false;};
  1033. if((speed player <= 1) && hasBagItem && _canDo) then {
  1034. if (s_player_selfBloodbag < 0) then {
  1035. s_player_selfBloodbag = player addaction[("<t color=""#c70000"">" + ("Self Bloodbag") +"</t>"),"Scripts\player_selfbloodbag.sqf","",5,false,true,"", ""];
  1036. };
  1037. } else {
  1038. player removeAction s_player_selfBloodbag;
  1039. s_player_selfBloodbag = -1;
  1040. };
  1041. // ------------------------------------------------------------------------Krixes Self Bloodbag End------------------------------------------------------------------------
  1042. //Grab Flare
  1043. if (_canPickLight and !dayz_hasLight) then {
  1044. if (s_player_grabflare < 0) then {
  1045. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  1046. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  1047. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  1048. };
  1049. } else {
  1050. player removeAction s_player_grabflare;
  1051. player removeAction s_player_removeflare;
  1052. s_player_grabflare = -1;
  1053. s_player_removeflare = -1;
  1054. };
  1055.  
  1056. if (dayz_onBack != "" && !dayz_onBackActive && !_inVehicle && !_onLadder && !r_player_unconscious) then {
  1057. if (s_player_equip_carry < 0) then {
  1058. _text = getText (configFile >> "CfgWeapons" >> dayz_onBack >> "displayName");
  1059. s_player_equip_carry = player addAction [format[localize "STR_ACTIONS_WEAPON", _text], "\z\addons\dayz_code\actions\player_switchWeapon.sqf", "action", 0.5, false, true];
  1060. };
  1061. } else {
  1062. player removeAction s_player_equip_carry;
  1063. s_player_equip_carry = -1;
  1064. };
  1065.  
  1066. //fishing
  1067. if ((_currentWeapon in Dayz_fishingItems) && !dayz_fishingInprogress && !_inVehicle) then {
  1068. if (s_player_fishing < 0) then {
  1069. s_player_fishing = player addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf","action", 0.5, false, true];
  1070. };
  1071. } else {
  1072. player removeAction s_player_fishing;
  1073. s_player_fishing = -1;
  1074. };
  1075.  
  1076. if (_inVehicle) then {
  1077. //_assignedRole = assignedVehicleRole player;
  1078. _driver = driver (vehicle player);
  1079. if ((_primaryWeapon in Dayz_fishingItems) && !dayz_fishingInprogress && (_vehicle isKindOf "Ship") && (_driver != player)) then {
  1080. if (s_player_fishing_veh < 0) then {
  1081. s_player_fishing_veh = _vehicle addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf","action", 0.5, false, true];
  1082. };
  1083. } else {
  1084. player removeAction s_player_fishing_veh;
  1085. s_player_fishing_veh = -1;
  1086. };
  1087. } else {
  1088. player removeAction s_player_fishing_veh;
  1089. s_player_fishing_veh = -1;
  1090. };
  1091.  
  1092. if (!isNull _cursorTarget and !_inVehicle and (player distance _cursorTarget < 4)) then { //Has some kind of target
  1093. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  1094. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  1095. _isVehicletype = typeOf _cursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  1096. _isMan = _cursorTarget isKindOf "Man";
  1097. _ownerID = _cursorTarget getVariable ["characterID","0"];
  1098. _isAnimal = _cursorTarget isKindOf "Animal";
  1099. _isZombie = _cursorTarget isKindOf "zZombie_base";
  1100. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  1101. _isTent = _cursorTarget isKindOf "TentStorage";
  1102. _isStash = _cursorTarget isKindOf "StashSmall";
  1103. _isMediumStash = _cursorTarget isKindOf "StashMedium";
  1104. _isFuel = false;
  1105. _hasFuel20 = "ItemJerrycan" in magazines player;
  1106. _hasFuel5 = "ItemFuelcan" in magazines player;
  1107. _isAlive = alive _cursorTarget;
  1108. _canmove = canmove _cursorTarget;
  1109. _text = getText (configFile >> "CfgVehicles" >> typeOf _cursorTarget >> "displayName");
  1110. _isPlant = typeOf _cursorTarget in Dayz_plants;
  1111.  
  1112. _rawmeat = meatraw;
  1113. _hasRawMeat = false;
  1114. {
  1115. if (_x in magazines player) then {
  1116. _hasRawMeat = true;
  1117. };
  1118. } forEach _rawmeat;
  1119.  
  1120. //gather
  1121. if(_isPlant and _canDo) then {
  1122. if (s_player_gather < 0) then {
  1123. _text = getText (configFile >> "CfgVehicles" >> typeOf _cursorTarget >> "displayName");
  1124. s_player_gather = player addAction [format[localize "str_actions_gather",_text], "\z\addons\dayz_code\actions\player_gather.sqf",_cursorTarget, 1, true, true, "", ""];
  1125. };
  1126. } else {
  1127. player removeAction s_player_gather;
  1128. s_player_gather = -1;
  1129. };
  1130. if (_hasFuelE20 or _hasFuelE5) then {
  1131. _isFuel = (_cursorTarget isKindOf "Land_Ind_TankSmall") or (_cursorTarget isKindOf "Land_fuel_tank_big") or (_cursorTarget isKindOf "Land_fuel_tank_stairs") or (_cursorTarget isKindOf "Land_wagon_tanker");
  1132. };
  1133. //diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  1134.  
  1135. //Allow player to delete objects
  1136. if(_isDestructable and _hasToolbox and _canDo) then {
  1137. if (s_player_deleteBuild < 0) then {
  1138. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  1139. };
  1140. } else {
  1141. player removeAction s_player_deleteBuild;
  1142. s_player_deleteBuild = -1;
  1143. };
  1144.  
  1145. //Allow player to force save
  1146. if((_isVehicle or _isTent or _isStash or _isMediumStash) and _canDo and !_isMan and (damage _cursorTarget < 1)) then {
  1147. if (s_player_forceSave < 0) then {
  1148. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  1149. };
  1150. } else {
  1151. player removeAction s_player_forceSave;
  1152. s_player_forceSave = -1;
  1153. };
  1154.  
  1155. //flip vehicle
  1156. if ((_isVehicletype) and !_canmove and _isAlive and (player distance _cursorTarget >= 2) and (count (crew _cursorTarget))== 0 and ((vectorUp _cursorTarget) select 2) < 0.5) then {
  1157. if (s_player_flipveh < 0) then {
  1158. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  1159. };
  1160. } else {
  1161. player removeAction s_player_flipveh;
  1162. player removeAction s_player_bury_human;
  1163. s_player_bury_human = -1;
  1164. s_player_flipveh = -1;
  1165. };
  1166.  
  1167. //Allow player to fill Fuel can
  1168. if((_hasFuelE20 or _hasFuelE5) and _isFuel and _canDo and !a_player_jerryfilling) then {
  1169. if (s_player_fillfuel < 0) then {
  1170. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  1171. };
  1172. } else {
  1173. player removeAction s_player_fillfuel;
  1174. s_player_fillfuel = -1;
  1175. };
  1176.  
  1177. //Allow player to fill vehilce 20L
  1178. if(_hasFuel20 and _canDo and _isVehicle and (fuel _cursorTarget < 1)) then {
  1179. if (s_player_fillfuel20 < 0) then {
  1180. s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10",_text,"20"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan"], 0, true, true, "", "'ItemJerrycan' in magazines player"];
  1181. };
  1182. } else {
  1183. player removeAction s_player_fillfuel20;
  1184. s_player_fillfuel20 = -1;
  1185. };
  1186.  
  1187. //Allow player to fill vehilce 5L
  1188. if(_hasFuel5 and _canDo and _isVehicle and (fuel _cursorTarget < 1)) then {
  1189. if (s_player_fillfuel5 < 0) then {
  1190. s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10",_text,"5"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan"], 0, true, true, "", "'ItemFuelcan' in magazines player"];
  1191. };
  1192. } else {
  1193. player removeAction s_player_fillfuel5;
  1194. s_player_fillfuel5 = -1;
  1195. };
  1196.  
  1197. //Allow player to spihon vehicles
  1198. if ((_hasFuelE20 or _hasFuelE5) and _isVehicle and _canDo and !a_player_jerryfilling and (fuel _cursorTarget > 0)) then {
  1199. if (s_player_siphonfuel < 0) then {
  1200. s_player_siphonfuel = player addAction [format[localize "str_siphon_start"], "\z\addons\dayz_code\actions\siphonFuel.sqf",_cursorTarget, 0, true, true, "", ""];
  1201. };
  1202. } else {
  1203. player removeAction s_player_siphonfuel;
  1204. s_player_siphonfuel = -1;
  1205. };
  1206.  
  1207. //Harvested
  1208. if (!alive _cursorTarget and _isAnimal and _hasKnife and !_isHarvested and _canDo) then {
  1209. if (s_player_butcher < 0) then {
  1210. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  1211. };
  1212. } else {
  1213. player removeAction s_player_butcher;
  1214. s_player_butcher = -1;
  1215. };
  1216.  
  1217. //Fireplace Actions check
  1218. if (inflamed _cursorTarget and _hasRawMeat and _canDo and !a_player_cooking) then {
  1219. if (s_player_cook < 0) then {
  1220. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  1221. };
  1222. } else {
  1223. player removeAction s_player_cook;
  1224. s_player_cook = -1;
  1225. };
  1226. if (inflamed _cursorTarget and (_hasbottleitem and _hastinitem) and _canDo and !a_player_boil) then {
  1227. if (s_player_boil < 0) then {
  1228. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  1229. };
  1230. } else {
  1231. player removeAction s_player_boil;
  1232. s_player_boil = -1;
  1233. };
  1234.  
  1235. if(_cursorTarget == dayz_hasFire and _canDo) then {
  1236. if ((s_player_fireout < 0) and !(inflamed _cursorTarget) and (player distance _cursorTarget < 3)) then {
  1237. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  1238. };
  1239. } else {
  1240. player removeAction s_player_fireout;
  1241. s_player_fireout = -1;
  1242. };
  1243.  
  1244. //Packing my tent
  1245. if(_cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  1246. if ((s_player_packtent < 0) and (player distance _cursorTarget < 3)) then {
  1247. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  1248. };
  1249. } else {
  1250. player removeAction s_player_packtent;
  1251. s_player_packtent = -1;
  1252. };
  1253. //Sleep
  1254. if(_cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  1255. if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
  1256. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  1257. };
  1258. } else {
  1259. player removeAction s_player_sleep;
  1260. s_player_sleep = -1;
  1261. };
  1262. //Repairing Vehicles
  1263. if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
  1264. if (s_player_repair_crtl < 0) then {
  1265. dayz_myCursorTarget = _cursorTarget;
  1266. _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  1267. //_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  1268. s_player_repairActions set [count s_player_repairActions,_menu];
  1269. //s_player_repairActions set [count s_player_repairActions,_menu1];
  1270. s_player_repair_crtl = 1;
  1271. } else {
  1272. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  1273. s_player_repair_crtl = -1;
  1274. };
  1275. };
  1276.  
  1277. if (!_isAlive and !_isZombie and !_isAnimal and _hasETool and _isMan and _canDo) then {
  1278. if (s_player_bury_human < 0) then {
  1279. s_player_bury_human = player addAction [format["Bury Body"], "fixes\bury_human.sqf",cursorTarget, 0, false, true, "", ""];
  1280. }
  1281. } else {
  1282. player removeAction s_player_bury_human;
  1283. s_player_bury_human = -1;
  1284. };
  1285. /*
  1286. if (_isMan and !_isAlive) then {
  1287. if (s_player_dragbody < 0) then {
  1288. s_player_dragbody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\drag_body.sqf",_cursorTarget, 0, false, true, "",""];
  1289. };
  1290. } else {
  1291. player removeAction s_player_dragbody;
  1292. s_player_dragbody = -1;
  1293. };
  1294. */
  1295. if (_isMan and !_isAlive and !_isZombie) then {
  1296. if (s_player_studybody < 0) then {
  1297. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
  1298. };
  1299. } else {
  1300. player removeAction s_player_studybody;
  1301. s_player_studybody = -1;
  1302. };
  1303. } else {
  1304. //Engineering
  1305. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  1306. player removeAction s_player_repair_crtl;
  1307. s_player_repair_crtl = -1;
  1308. dayz_myCursorTarget = objNull;
  1309. //Others
  1310. player removeAction s_player_forceSave;
  1311. s_player_forceSave = -1;
  1312. player removeAction s_player_flipveh;
  1313. player removeAction s_player_bury_human;
  1314. s_player_bury_human = -1;
  1315. s_player_flipveh = -1;
  1316. player removeAction s_player_sleep;
  1317. s_player_sleep = -1;
  1318. player removeAction s_player_deleteBuild;
  1319. s_player_deleteBuild = -1;
  1320. player removeAction s_player_butcher;
  1321. s_player_butcher = -1;
  1322. player removeAction s_player_cook;
  1323. s_player_cook = -1;
  1324. player removeAction s_player_boil;
  1325. s_player_boil = -1;
  1326. player removeAction s_player_fireout;
  1327. s_player_fireout = -1;
  1328. player removeAction s_player_packtent;
  1329. s_player_packtent = -1;
  1330. player removeAction s_player_fillfuel;
  1331. s_player_fillfuel = -1;
  1332. player removeAction s_player_studybody;
  1333. s_player_studybody = -1;
  1334. /*
  1335. //Drag Body
  1336. player removeAction s_player_dragbody;
  1337. s_player_dragbody = -1;
  1338. */
  1339. //fuel
  1340. player removeAction s_player_fillfuel20;
  1341. s_player_fillfuel20 = -1;
  1342. player removeAction s_player_fillfuel5;
  1343. s_player_fillfuel5 = -1;
  1344.  
  1345. //Allow player to spihon vehicle fuel
  1346. player removeAction s_player_siphonfuel;
  1347. s_player_siphonfuel = -1;
  1348.  
  1349. //Allow player to gather
  1350. player removeAction s_player_gather;
  1351. s_player_gather = -1;
  1352. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement