Advertisement
Guest User

fn_self

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