Advertisement
Guest User

fn_selfActions.sqf

a guest
Mar 5th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.10 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. //--------------------------------------ARREST INKKO----------------------------------------------------------------
  403. if (player getVariable "Detain" == 1) then {
  404. player removeAction s_player_arrest;
  405. };
  406. if(_isMan && !_isZombie && _canDo && _isAlive && !_isAnimal && _string && _side) then {
  407. if (s_player_arrest < 0) then {
  408. s_player_arrest = player addaction [("<t color=""#0074E8"">" + ("Detain") +"</t>"), "ATPExclusion\Detain.sqf","",100,false,true,"", ""];
  409. };
  410. } else {
  411. player removeAction s_player_arrest;
  412. s_player_arrest = -1;
  413. };
  414. if ((_cursorTarget getVariable "Detain" == 1) && cursorTarget distance player < 2 ) then
  415. {
  416. if(_isMan && !_isZombie && _canDo && _isAlive) then {
  417. if (s_player_escort < 0) then {
  418. s_player_escort = player addaction [("<t color=""#0074E8"">" + ("Escort") +"</t>"), "ATPExclusion\Escort.sqf",_cursorTarget, 1, true, true, "", ""];
  419. };
  420. } else {
  421. player removeAction s_player_escort;
  422. s_player_escort = -1;
  423. };
  424. if(_isMan && !_isZombie && _canDo && _isAlive) then {
  425. if (s_player_search < 0) then {
  426. s_player_search = player addaction [("<t color=""#0074E8"">" + ("Search") +"</t>"), "ATPExclusion\Search.sqf",_cursorTarget, 1, true, true, "", ""];
  427. };
  428. } else {
  429. player removeAction s_player_search;
  430. s_player_search = -1;
  431. };
  432.  
  433. if(_isMan && !_isZombie && _canDo && _isAlive) then {
  434. if (s_player_release < 0) then {
  435. s_player_release = player addaction [("<t color=""#0074E8"">" + ("Release") +"</t>"), "ATPExclusion\release.sqf",_cursorTarget, 1, true, true, "", ""];
  436. };
  437. } else {
  438. player removeAction s_player_release;
  439. s_player_release = -1;
  440. };
  441. };
  442. //-------------------------------------------------------------------------------------------------------------
  443.  
  444. if(DZE_AllowForceSave) then {
  445. //Allow player to force save
  446. if((_isVehicle or _isTent) and !_isMan) then {
  447. if (s_player_forceSave < 0) then {
  448. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  449. };
  450. } else {
  451. player removeAction s_player_forceSave;
  452. s_player_forceSave = -1;
  453. };
  454. };
  455.  
  456.  
  457.  
  458. If(DZE_AllowCargoCheck) then {
  459. if((_isVehicle or _isTent or _isnewstorage) and _isAlive and !_isMan and !locked _cursorTarget) then {
  460. if (s_player_checkGear < 0) then {
  461. s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  462. };
  463. } else {
  464. player removeAction s_player_checkGear;
  465. s_player_checkGear = -1;
  466. };
  467. };
  468.  
  469.  
  470. //flip vehicle small vehicles by your self and all other vehicles with help nearby
  471. if(_player_flipveh) then {
  472. if (s_player_flipveh < 0) then {
  473. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  474. };
  475. } else {
  476. player removeAction s_player_flipveh;
  477. s_player_flipveh = -1;
  478. };
  479.  
  480. //Allow player to fill jerrycan
  481. if((_hasFuelE or _hasFuelBarrelE) and _isFuel) then {
  482. if (s_player_fillfuel < 0) then {
  483. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  484. };
  485. } else {
  486. player removeAction s_player_fillfuel;
  487. s_player_fillfuel = -1;
  488. };
  489.  
  490. // logic vars for addactions
  491. _player_butcher = false;
  492. _player_studybody = false;
  493. _player_SurrenderedGear = false;
  494.  
  495. // CURSOR TARGET NOT ALIVE
  496. if (!_isAlive) then {
  497.  
  498. // Gut animal/zed
  499. if((_isAnimal or _isZombie) and _hasKnife) then {
  500. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  501. if (!_isHarvested) then {
  502. _player_butcher = true;
  503. };
  504. };
  505. if (!_isAlive and !_isZombie and !_isAnimal and _hasETool and _isMan and _canDo) then {
  506. if (s_player_bury_human < 0) then {
  507. s_player_bury_human = player addAction [format["Bury Body"], "fixes\bury_human.sqf",cursorTarget, 3, true, true, "", ""];
  508. }
  509. } else {
  510. player removeAction s_player_bury_human;
  511. s_player_bury_human = -1;
  512. };
  513. // Study body
  514. if (_isMan and !_isZombie and !_isAnimal) then {
  515. _player_studybody = true;
  516. }
  517. } else {
  518. // unit alive
  519.  
  520. // gear access on surrendered player
  521. if(_isMan and !_isZombie and !_isAnimal) then {
  522. _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  523. if (_isSurrendered) then {
  524. _player_SurrenderedGear = true;
  525. };
  526. };
  527. };
  528.  
  529. // Human Gut animal or zombie
  530. if (_player_butcher) then {
  531. if (s_player_butcher < 0) then {
  532. if(_isZombie) then {
  533. s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  534. } else {
  535. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  536. };
  537. };
  538. } else {
  539. player removeAction s_player_butcher;
  540. s_player_butcher = -1;
  541. };
  542.  
  543. // Study Body
  544. if (_player_studybody) then {
  545. if (s_player_studybody < 0) then {
  546. s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];
  547. };
  548. } else {
  549. player removeAction s_player_studybody;
  550. s_player_studybody = -1;
  551. };
  552.  
  553. // logic vars
  554. _player_cook = false;
  555. _player_boil = false;
  556.  
  557. // CURSOR TARGET IS FIRE
  558. if (inflamed _cursorTarget) then {
  559.  
  560. //Fireplace Actions check
  561. if (_hasRawMeat) then {
  562. _player_cook = true;
  563. };
  564.  
  565. // Boil water
  566. if (_hasbottleitem and _hastinitem) then {
  567. _player_boil = true;
  568. };
  569. };
  570.  
  571. if (_player_SurrenderedGear) then {
  572. if (s_player_SurrenderedGear < 0) then {
  573. s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTION_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
  574. };
  575. } else {
  576. player removeAction s_player_SurrenderedGear;
  577. s_player_SurrenderedGear = -1;
  578. };
  579.  
  580. //Fireplace Actions check
  581. if (_player_cook) then {
  582. if (s_player_cook < 0) then {
  583. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  584. };
  585. } else {
  586. player removeAction s_player_cook;
  587. s_player_cook = -1;
  588. };
  589.  
  590. // Boil water
  591. if (_player_boil) then {
  592. if (s_player_boil < 0) then {
  593. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  594. };
  595. } else {
  596. player removeAction s_player_boil;
  597. s_player_boil = -1;
  598. };
  599.  
  600. if(_cursorTarget == dayz_hasFire) then {
  601. if ((s_player_fireout < 0) and !(inflamed _cursorTarget) and (player distance _cursorTarget < 3)) then {
  602. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  603. };
  604. } else {
  605. player removeAction s_player_fireout;
  606. s_player_fireout = -1;
  607. };
  608.  
  609. //Packing my tent
  610. if(_isTent and (player distance _cursorTarget < 3)) then {
  611. if (_ownerID == dayz_characterID) then {
  612. if (s_player_packtent < 0) then {
  613. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  614. };
  615. } else {
  616. if(("ItemJerrycan" in _magazinesPlayer) and ("ItemMatchbox_DZE" in weapons player)) then {
  617. if (s_player_packtent < 0) then {
  618. s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  619. };
  620. };
  621. };
  622. } else {
  623. player removeAction s_player_packtent;
  624. s_player_packtent = -1;
  625. };
  626.  
  627. //Allow owner to unlock vault
  628. if((_typeOfCursorTarget in DZE_LockableStorage) and _ownerID != "0" and (player distance _cursorTarget < 3)) then {
  629. if (s_player_unlockvault < 0) then {
  630. if(_typeOfCursorTarget in DZE_LockedStorage) then {
  631. if(_ownerID == dayz_combination or _ownerID == dayz_playerUID) then {
  632. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  633. s_player_combi set [count s_player_combi,_combi];
  634. } else {
  635. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  636. s_player_combi set [count s_player_combi,_combi];
  637. };
  638. s_player_unlockvault = 1;
  639. } else {
  640. if(_ownerID != dayz_combination and _ownerID != dayz_playerUID) then {
  641. _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  642. s_player_combi set [count s_player_combi,_combi];
  643. s_player_unlockvault = 1;
  644. };
  645. };
  646. };
  647. } else {
  648. {player removeAction _x} forEach s_player_combi;s_player_combi = [];
  649. s_player_unlockvault = -1;
  650. };
  651.  
  652. //Allow owner to pack vault
  653. if(_typeOfCursorTarget in DZE_UnLockedStorage and _ownerID != "0" and (player distance _cursorTarget < 3)) then {
  654.  
  655. if (s_player_lockvault < 0) then {
  656. if(_ownerID == dayz_combination or _ownerID == dayz_playerUID) then {
  657. s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  658. };
  659. };
  660. if (s_player_packvault < 0 and (_ownerID == dayz_combination or _ownerID == dayz_playerUID)) then {
  661. 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, "",""];
  662. };
  663. } else {
  664. player removeAction s_player_packvault;
  665. s_player_packvault = -1;
  666. player removeAction s_player_lockvault;
  667. s_player_lockvault = -1;
  668. };
  669.  
  670.  
  671.  
  672. //Player Deaths
  673. if(_typeOfCursorTarget == "Info_Board_EP1") then {
  674. if (s_player_information < 0) then {
  675. s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  676. };
  677. } else {
  678. player removeAction s_player_information;
  679. s_player_information = -1;
  680. };
  681.  
  682. //Fuel Pump
  683. if(_typeOfCursorTarget in dayz_fuelpumparray) then {
  684. if (s_player_fuelauto < 0) then {
  685.  
  686. // check if Generator_DZ is running within 30 meters
  687. _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  688. _findNearestGen = [];
  689. {
  690. if (alive _x and (_x getVariable ["GeneratorRunning", false])) then {
  691. _findNearestGen set [(count _findNearestGen),_x];
  692. };
  693. } foreach _findNearestGens;
  694. _IsNearRunningGen = count (_findNearestGen);
  695.  
  696. // show that pump needs power if no generator nearby.
  697. if(_IsNearRunningGen > 0) then {
  698. s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  699. } else {
  700. s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  701. };
  702. };
  703. } else {
  704. player removeAction s_player_fuelauto;
  705. s_player_fuelauto = -1;
  706. };
  707.  
  708. //Fuel Pump on truck
  709. if(_typeOfCursorTarget in DZE_fueltruckarray and alive _cursorTarget) then {
  710. if (s_player_fuelauto2 < 0) then {
  711. // show that fuel truck pump needs power.
  712. if(isEngineOn _cursorTarget) then {
  713. s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  714. } else {
  715. s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  716. };
  717. };
  718. } else {
  719. player removeAction s_player_fuelauto2;
  720. s_player_fuelauto2 = -1;
  721. };
  722.  
  723. // inplace upgrade tool
  724. if ((_cursorTarget isKindOf "ModularItems") or (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") or (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  725. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  726. if (s_player_upgrade_build > 0) then {
  727. player removeAction s_player_upgrade_build;
  728. s_player_upgrade_build = -1;
  729. };
  730. };
  731. if (s_player_upgrade_build < 0) then {
  732. // s_player_lastTarget = _cursorTarget;
  733. s_player_lastTarget set [0,_cursorTarget];
  734. 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, "",""];
  735. };
  736. } else {
  737. player removeAction s_player_upgrade_build;
  738. s_player_upgrade_build = -1;
  739. };
  740.  
  741. // downgrade system
  742. if((_isDestructable or _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" or _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") and (DZE_Lock_Door == _ownerID)) then {
  743. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  744. if (s_player_downgrade_build > 0) then {
  745. player removeAction s_player_downgrade_build;
  746. s_player_downgrade_build = -1;
  747. };
  748. };
  749.  
  750. if (s_player_downgrade_build < 0) then {
  751. s_player_lastTarget set [1,_cursorTarget];
  752. 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, "",""];
  753. };
  754. } else {
  755. player removeAction s_player_downgrade_build;
  756. s_player_downgrade_build = -1;
  757. };
  758.  
  759. // inplace maintenance tool
  760. if((_cursorTarget isKindOf "ModularItems" or _cursorTarget isKindOf "DZE_Housebase" or _typeOfCursorTarget in DZE_ExtraMaintain) and (damage _cursorTarget >= 0.1)) then {
  761. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  762. if (s_player_maint_build > 0) then {
  763. player removeAction s_player_maint_build;
  764. s_player_maint_build = -1;
  765. };
  766. };
  767.  
  768. if (s_player_maint_build < 0) then {
  769. s_player_lastTarget set [2,_cursorTarget];
  770. 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, "",""];
  771. };
  772. } else {
  773. player removeAction s_player_maint_build;
  774. s_player_maint_build = -1;
  775. };
  776.  
  777.  
  778. //Start Generator
  779. if(_cursorTarget isKindOf "Generator_DZ") then {
  780. if (s_player_fillgen < 0) then {
  781.  
  782. // check if not running
  783. if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  784. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  785. } else {
  786. // check if not filled and player has jerry.
  787. if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  788. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  789. } else {
  790. if("ItemJerrycan" in _magazinesPlayer) then {
  791. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  792. };
  793. };
  794. };
  795. };
  796. } else {
  797. player removeAction s_player_fillgen;
  798. s_player_fillgen = -1;
  799. };
  800.  
  801. //Towing with tow truck
  802. /*
  803. if(_typeOfCursorTarget == "TOW_DZE") then {
  804. if (s_player_towing < 0) then {
  805. if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  806. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  807. } else {
  808. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  809. };
  810. };
  811. } else {
  812. player removeAction s_player_towing;
  813. s_player_towing = -1;
  814. };
  815. */
  816.  
  817.  
  818. //Sleep
  819. if(_isTent and _ownerID == dayz_characterID) then {
  820. if ((s_player_sleep < 0) and (player distance _cursorTarget < 3)) then {
  821. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  822. };
  823. } else {
  824. player removeAction s_player_sleep;
  825. s_player_sleep = -1;
  826. };
  827.  
  828. //Repairing Vehicles
  829. if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then {
  830. if (s_player_repair_crtl < 0) then {
  831. dayz_myCursorTarget = _cursorTarget;
  832. _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  833. _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  834. s_player_repairActions set [count s_player_repairActions,_menu];
  835. s_player_repairActions set [count s_player_repairActions,_menu1];
  836. s_player_repair_crtl = 1;
  837. } else {
  838. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  839. s_player_repair_crtl = -1;
  840. };
  841. };
  842.  
  843. // All Traders
  844. if (_isMan and !_isPZombie and _traderType in serverTraders) then {
  845.  
  846. if (s_player_parts_crtl < 0) then {
  847.  
  848. // get humanity
  849. _humanity = player getVariable ["humanity",0];
  850. _traderMenu = call compile format["menu_%1;",_traderType];
  851.  
  852. // diag_log ("TRADER = " + str(_traderMenu));
  853.  
  854. _low_high = "low";
  855. _humanity_logic = false;
  856. if((_traderMenu select 2) == "friendly") then {
  857. _humanity_logic = (_humanity < -5000);
  858. };
  859. if((_traderMenu select 2) == "hostile") then {
  860. _low_high = "high";
  861. _humanity_logic = (_humanity > -5000);
  862. };
  863. if((_traderMenu select 2) == "hero") then {
  864. _humanity_logic = (_humanity < 5000);
  865. };
  866. if(_humanity_logic) then {
  867. _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  868. s_player_parts set [count s_player_parts,_cancel];
  869. } else {
  870.  
  871. // Static Menu
  872. {
  873. //diag_log format["DEBUG TRADER: %1", _x];
  874. _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, "",""];
  875. s_player_parts set [count s_player_parts,_buy];
  876.  
  877. } forEach (_traderMenu select 1);
  878. // Database menu
  879. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 99, true, false, "",""];
  880. s_player_parts set [count s_player_parts,_buy];
  881.  
  882. // Add static metals trader options under sub menu
  883. _metals_trader = player addAction [localize "STR_EPOCH_PLAYER_301", "\z\addons\dayz_code\actions\trade_metals.sqf",["na"], 0, true, false, "",""];
  884. s_player_parts set [count s_player_parts,_metals_trader];
  885.  
  886. };
  887. s_player_parts_crtl = 1;
  888.  
  889. };
  890. } else {
  891. {player removeAction _x} forEach s_player_parts;s_player_parts = [];
  892. s_player_parts_crtl = -1;
  893. };
  894.  
  895.  
  896. if(dayz_tameDogs) then {
  897.  
  898. //Dog
  899. if (_isDog and _isAlive and (_hasRawMeat) and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
  900. if (s_player_tamedog < 0) then {
  901. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  902. };
  903. } else {
  904. player removeAction s_player_tamedog;
  905. s_player_tamedog = -1;
  906. };
  907. if (_isDog and _ownerID == dayz_characterID and _isAlive) then {
  908. _dogHandle = player getVariable ["dogID", 0];
  909. if (s_player_feeddog < 0 and _hasRawMeat) then {
  910. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  911. };
  912. if (s_player_waterdog < 0 and "ItemWaterbottle" in _magazinesPlayer) then {
  913. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  914. };
  915. if (s_player_staydog < 0) then {
  916. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  917. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  918. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  919. };
  920. if (s_player_trackdog < 0) then {
  921. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  922. };
  923. if (s_player_barkdog < 0) then {
  924. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  925. };
  926. if (s_player_warndog < 0) then {
  927. _warn = _dogHandle getFSMVariable "_watchDog";
  928. if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  929. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  930. };
  931. if (s_player_followdog < 0) then {
  932. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  933. };
  934. } else {
  935. player removeAction s_player_feeddog;
  936. s_player_feeddog = -1;
  937. player removeAction s_player_waterdog;
  938. s_player_waterdog = -1;
  939. player removeAction s_player_staydog;
  940. s_player_staydog = -1;
  941. player removeAction s_player_trackdog;
  942. s_player_trackdog = -1;
  943. player removeAction s_player_barkdog;
  944. s_player_barkdog = -1;
  945. player removeAction s_player_warndog;
  946. s_player_warndog = -1;
  947. player removeAction s_player_followdog;
  948. s_player_followdog = -1;
  949. };
  950. };
  951.  
  952. } else {
  953. //Engineering
  954. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  955. s_player_repair_crtl = -1;
  956.  
  957. {player removeAction _x} forEach s_player_combi;s_player_combi = [];
  958.  
  959. dayz_myCursorTarget = objNull;
  960. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  961.  
  962. {player removeAction _x} forEach s_player_parts;s_player_parts = [];
  963. s_player_parts_crtl = -1;
  964.  
  965. {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
  966. s_player_lockUnlock_crtl = -1;
  967.  
  968. player removeAction s_player_checkGear;
  969. s_player_checkGear = -1;
  970.  
  971. player removeAction s_player_SurrenderedGear;
  972. s_player_SurrenderedGear = -1;
  973. //*****Arrest INKKO & Schwede*****
  974. player removeAction s_player_arrest;
  975. s_player_arrest = -1;
  976. player removeAction s_player_release;
  977. s_player_release = -1;
  978. player removeAction s_player_escort;
  979. s_player_escort = -1;
  980. player removeAction s_player_search;
  981. s_player_search = -1;
  982. //Others
  983. player removeAction s_player_forceSave;
  984. s_player_forceSave = -1;
  985. player removeAction s_player_flipveh;
  986. s_player_flipveh = -1;
  987. player removeAction s_player_sleep;
  988. s_player_sleep = -1;
  989. player removeAction s_player_deleteBuild;
  990. s_player_deleteBuild = -1;
  991. player removeAction s_player_butcher;
  992. s_player_butcher = -1;
  993. player removeAction s_player_cook;
  994. s_player_cook = -1;
  995. player removeAction s_player_boil;
  996. s_player_boil = -1;
  997. player removeAction s_player_fireout;
  998. s_player_fireout = -1;
  999. player removeAction s_player_packtent;
  1000. s_player_packtent = -1;
  1001. player removeAction s_player_fillfuel;
  1002. s_player_fillfuel = -1;
  1003. player removeAction s_player_studybody;
  1004. s_player_studybody = -1;
  1005. //Dog
  1006. player removeAction s_player_tamedog;
  1007. s_player_tamedog = -1;
  1008. player removeAction s_player_feeddog;
  1009. s_player_feeddog = -1;
  1010. player removeAction s_player_waterdog;
  1011. s_player_waterdog = -1;
  1012. player removeAction s_player_staydog;
  1013. s_player_staydog = -1;
  1014. player removeAction s_player_trackdog;
  1015. s_player_trackdog = -1;
  1016. player removeAction s_player_barkdog;
  1017. s_player_barkdog = -1;
  1018. player removeAction s_player_warndog;
  1019. s_player_warndog = -1;
  1020. player removeAction s_player_followdog;
  1021. s_player_followdog = -1;
  1022.  
  1023. // vault
  1024. player removeAction s_player_unlockvault;
  1025. s_player_unlockvault = -1;
  1026. player removeAction s_player_packvault;
  1027. s_player_packvault = -1;
  1028. player removeAction s_player_lockvault;
  1029. s_player_lockvault = -1;
  1030.  
  1031. player removeAction s_player_information;
  1032. s_player_information = -1;
  1033. player removeAction s_player_fillgen;
  1034. s_player_fillgen = -1;
  1035. player removeAction s_player_upgrade_build;
  1036. s_player_upgrade_build = -1;
  1037. player removeAction s_player_maint_build;
  1038. s_player_maint_build = -1;
  1039. player removeAction s_player_downgrade_build;
  1040. s_player_downgrade_build = -1;
  1041. player removeAction s_player_towing;
  1042. s_player_towing = -1;
  1043. player removeAction s_player_fuelauto;
  1044. s_player_fuelauto = -1;
  1045. player removeAction s_player_fuelauto2;
  1046. s_player_fuelauto2 = -1;
  1047. //Arrest
  1048. //player removeAction s_player_arrest;
  1049. //s_player_arrest = -1;
  1050. };
  1051.  
  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 and !_inVehicle and alive _dog and _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. player removeAction toggleRadioOff;
  1082. toggleRadioOff = -1;
  1083. player removeAction toggleRadioOn;
  1084. toggleRadioOn = -1;
  1085. };
  1086. //-------------------------------Mergs Church cure-------------------------------------
  1087.  
  1088. private["_playerPos","_canCure"];
  1089. _playerPos = getPosATL player;
  1090. _canCure = count nearestObjects [_playerPos, ["Land_Church_01","Land_Church_03","Land_Church_02","Land_Church_02a"], 20] > 0;
  1091.  
  1092. if (_canCure) then {
  1093. if (s_church_cure < 0) then {
  1094. s_church_cure = player addaction[("<t color=""#FF0000"">" + ("Cure Infection") +"</t>"),"Scripts\church_cure.sqf"];
  1095. };
  1096. } else {
  1097. player removeAction s_church_cure;
  1098. s_church_cure = -1;
  1099. };
  1100. //-----------------------------Mergs Church cure end-------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement