Advertisement
Guest User

Untitled

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