Advertisement
Guest User

Untitled

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