Advertisement
Guest User

Untitled

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