Advertisement
Guest User

Self Actions 1

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