Advertisement
Guest User

fn_selfActions.sqf

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