Advertisement
Guest User

self

a guest
Nov 2nd, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.13 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 ["_buildOwner","_nearestBuilding","_nearestBuildList","_originHousing","_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 && !r_player_unconscious && !_onLadder);
  17.  
  18. _adminsList= call compile preProcessFileLineNumbers "superadmins.sqf";
  19. if(("Cobalt_File" in items player) and ((getPlayerUID player) in _adminsList)) then {
  20. if (s_player_run_events < 0) then {
  21. s_player_run_events = player addaction [("<t color=""#0074E8"">" + ("Events Menu") +"</t>"),"custom\fixes\execute.sqf","",5,false,true,"",""];
  22. };
  23. } else {
  24. player removeAction s_player_run_events;
  25. s_player_run_events = -1;
  26. };
  27. _nearLight = nearestObject [player,"LitObject"];
  28. _canPickLight = false;
  29. if (!isNull _nearLight) then {
  30. if (_nearLight distance player < 4) then {
  31. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  32. };
  33. };
  34.  
  35. //Grab Flare
  36. if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
  37. if (s_player_grabflare < 0) then {
  38. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  39. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  40. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  41. };
  42. } else {
  43. player removeAction s_player_grabflare;
  44. player removeAction s_player_removeflare;
  45. s_player_grabflare = -1;
  46. s_player_removeflare = -1;
  47. };
  48.  
  49. if (_inVehicle && {_vehicle isKindOf "MV22"}) then {
  50. if (isEngineOn _vehicle) then {[_vehicle,0] call mv22_pack;};
  51. if (mv22_fold < 0) then {
  52. themv22 = _vehicle;
  53. if !(isEngineOn themv22) then {
  54. mv22_fold = themv22 addAction ["Fold","scripts\animate\mv22_fold.sqf","",5,false,true];
  55. mv22_unfold = themv22 addAction ["UnFold","scripts\animate\mv22_unfold.sqf","",5,false,true];
  56. mv22_open = themv22 addAction ["Open Ramp","scripts\animate\mv22_open.sqf","",5,false,true];
  57. mv22_close = themv22 addAction ["Close Ramp","scripts\animate\mv22_close.sqf","",5,false,true];
  58. };
  59. };
  60. if (isEngineOn themv22) then {
  61. themv22 removeAction mv22_fold;
  62. mv22_fold = -1;
  63. themv22 removeAction mv22_unfold;
  64. mv22_unfold = -1;
  65. themv22 removeAction mv22_open;
  66. mv22_open = -1;
  67. themv22 removeAction mv22_close;
  68. mv22_close = -1;
  69. };
  70. } else {
  71. if (!isNil "themv22") then {
  72. themv22 removeAction mv22_fold;
  73. mv22_fold = -1;
  74. themv22 removeAction mv22_unfold;
  75. mv22_unfold = -1;
  76. themv22 removeAction mv22_open;
  77. mv22_open = -1;
  78. themv22 removeAction mv22_close;
  79. mv22_close = -1;
  80. };
  81. };
  82.  
  83. if (_inVehicle && {_vehicle isKindOf "ArmoredSUV_Base_PMC"}) then {
  84. if ((_vehicle animationPhase "HideGun_01") == 1) then {
  85. _unit = _vehicle turretUnit [0];
  86. if (!(isNull _unit)) then {
  87. _unit action ["moveToCargo",_vehicle,2];
  88. titleText ["\n\nYou must open the hatch first.","PLAIN DOWN"];titleFadeOut 4;
  89. };
  90. };
  91. if (suv_close < 0) then {
  92. thesuv = _vehicle;
  93. suv_close = thesuv addAction ["Close Hatch","scripts\animate\suv_close.sqf","",5,false,true];
  94. suv_open = thesuv addAction ["Open Hatch","scripts\animate\suv_open.sqf","",5,false,true];
  95. };
  96. } else {
  97. if (!isNil "thesuv") then {
  98. thesuv removeAction suv_close;
  99. suv_close = -1;
  100. thesuv removeAction suv_open;
  101. suv_open = -1;
  102. };
  103. };
  104. if (DZE_HeliLift) then {
  105. _hasAttached = _vehicle getVariable["hasAttached",false];
  106. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
  107. if (s_player_heli_detach < 0) then {
  108. dayz_myLiftVehicle = _vehicle;
  109. s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
  110. };
  111. } else {
  112. dayz_myLiftVehicle removeAction s_player_heli_detach;
  113. s_player_heli_detach = -1;
  114. };
  115. };
  116.  
  117. if(DZE_HaloJump) then {
  118. if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
  119. if (s_halo_action < 0) then {
  120. DZE_myHaloVehicle = _vehicle;
  121. s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
  122. };
  123. } else {
  124. DZE_myHaloVehicle removeAction s_halo_action;
  125. s_halo_action = -1;
  126. };
  127. };
  128.  
  129. if (!DZE_ForceNameTagsOff) then {
  130. if (s_player_showname < 0 && !_isPZombie) then {
  131. if (DZE_ForceNameTags) then {
  132. s_player_showname = 1;
  133. player setVariable["DZE_display_name",true,true];
  134. } else {
  135. s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
  136. s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
  137. };
  138. };
  139. };
  140.  
  141. if(DZE_Origins_Building_System) then {
  142. if(isnil "s_player_build_origins_house") then {s_player_build_origins_house = -1;};
  143. if(isnil "s_player_build_origins_garage") then {s_player_build_origins_garage = -1;};
  144. if(isnil "s_player_build_origins_stronghold") then {s_player_build_origins_stronghold = -1;};
  145. if(isnil "s_player_origins_unlock") then {s_player_origins_unlock = -1;};
  146. if(isnil "s_player_origins_stronghold_doors") then {s_player_origins_stronghold_doors = -1;};
  147. _cursorTarget = cursorTarget;
  148. if (!isNull _cursorTarget) then {
  149. _typeOfCursorTarget = (typeOf _cursorTarget);
  150. if(_typeOfCursorTarget == DZE_Origins_Container ) then {
  151. if((player distance _cursorTarget) < DZE_Origins_Build_Distance) then {
  152. private["_humanity","_playerUID","_hasLevel1","_hasLevel2","_hasLevel3","_hasSG","_hasLG","_hasKING","_hasSH","_canBuildHouse","_houselevel","_humanityNeed","_actionText","_classname","_neededMaterials","_canBuildSH","_canBuildGarage"];
  153. _humanity = player getVariable["humanity",0];
  154. _playerUID = dayz_playerUID;
  155. _hasLevel1 = (_playerUID in owner_H1 || _playerUID in owner_B1);
  156. _hasLevel2 = (_playerUID in owner_H2 || _playerUID in owner_B2);
  157. _hasLevel3 = (_playerUID in owner_H3 || _playerUID in owner_B3);
  158. _hasSG = (_playerUID in owner_SG);
  159. _hasLG = (_playerUID in owner_LG);
  160. _hasKING = (_playerUID in owner_KING);
  161. _hasSH = (_playerUID in owner_SH);
  162.  
  163. {
  164. _houselevel = _x select 0;
  165. _humanityNeed = _x select 1;
  166. _actionText = _x select 2;
  167. _classname = _x select 3;
  168. _neededMaterials = _x select 4;
  169. _canBuildHouse = false;
  170. _canBuildGarage = false;
  171. _canBuildSH = false;
  172.  
  173. if((_humanityNeed > 0 && _humanity >= _humanityNeed) || (_humanityNeed < 0 && _humanity <= _humanityNeed)) then {
  174. if(_houselevel in ["H1","B1"] && !_hasLevel1) then {
  175. _canBuildHouse = true;
  176. };
  177. if(_houselevel in ["H2","B2"] && !_hasLevel2) then {
  178. _canBuildHouse = true;
  179. };
  180. if(_houselevel in ["H3","B3"] && !_hasLevel3) then {
  181. _canBuildHouse = true;
  182. };
  183. if(_houselevel in ["SGH","SGB"] && _hasLevel1 && !_hasSG) then {
  184. _canBuildGarage = true;
  185. };
  186. if(_houselevel in ["LGH","LGB"] && _hasLevel3 && !_hasLG) then {
  187. _canBuildGarage = true;
  188. };
  189. if(_houselevel in ["KINGH","KINGB"] && _hasLevel3 && _hasLG && !_hasKING) then {
  190. _canBuildGarage = true;
  191. };
  192. if(_houselevel in ["SHH","SHB"] && _hasLevel1 && _hasLevel2 && _hasLevel3 && !_hasSH) then {
  193. _canBuildSH = true;
  194. };
  195. };
  196.  
  197. if(_canBuildHouse) then {
  198. if(s_player_build_origins_house < 0) then {
  199. s_player_build_origins_house = player addAction ["Build " + _actionText, "origins\player_build.sqf", [_cursorTarget, _houselevel, _classname, _neededMaterials, _actionText]];
  200. };
  201. };
  202. if(_canBuildGarage) then {
  203. if(s_player_build_origins_garage < 0) then {
  204. s_player_build_origins_garage = player addAction ["Build " + _actionText, "origins\player_build.sqf", [_cursorTarget, _houselevel, _classname, _neededMaterials, _actionText]];
  205. };
  206. };
  207. if(_canBuildSH) then {
  208. if(s_player_build_origins_stronghold < 0) then {
  209. s_player_build_origins_stronghold = player addAction ["Build " + _actionText, "origins\player_build.sqf", [_cursorTarget, _houselevel, _classname, _neededMaterials, _actionText]];
  210. };
  211. };
  212.  
  213. } forEach DZE_Origins_Build_HousesGarages;
  214. } else {
  215. [1] call origins_removeActions;
  216. };
  217. };
  218.  
  219. if(_typeOfCursorTarget in DZE_Origins_Buildings && (player distance _cursorTarget) < DZE_Origins_LockUnlock_Distance) then {
  220. private["_ownerUID","_ownerName","_playerUID","_state","_openClose"];
  221. _playerUID = dayz_playerUID;
  222. _ownerUID = _cursorTarget getVariable ["OwnerUID","0"];
  223. _ownerName = _cursorTarget getVariable ["OwnerName","0"];
  224.  
  225. if(_playerUID != _ownerUID && !(_typeOfCursorTarget in DZE_Origins_Stronghold)) exitWith {
  226. cutText [format["This house was built by %1", _ownerName], "PLAIN DOWN",5];
  227. sleep 5;
  228. };
  229. _state = (_cursorTarget getVariable ["CanBeUpdated",false]);
  230. if(_typeOfCursorTarget in DZE_Origins_Stronghold && _state) then {
  231. private["_strongholdDoorsOpen"];
  232. _strongholdDoorsOpen = (_cursorTarget getVariable ["DoorsOpen",false]);
  233. if(_strongholdDoorsOpen) then {
  234. if(s_player_origins_stronghold_doors < 0) then {
  235. s_player_origins_stronghold_doors = player addAction [ "Close Doors","origins\origins_strongholdDoors.sqf",[_cursorTarget,0]];
  236. };
  237. } else {
  238. if(s_player_origins_stronghold_doors < 0)then {
  239. s_player_origins_stronghold_doors = player addAction [ "Open Doors","origins\origins_strongholdDoors.sqf",[_cursorTarget,1]];
  240. };
  241. };
  242. } else {
  243. [3] call origins_removeActions;
  244. };
  245.  
  246. if(s_player_origins_unlock < 0) then {
  247. _matched = false;
  248. {
  249. if(_typeOfCursorTarget == (_x select 0)) then {
  250. if(_state) then {
  251. _openClose = format["Lock %1", _X select 1];
  252. } else {
  253. _openClose = format["Unlock %1", _X select 1];
  254. };
  255. _matched = true;
  256. };
  257. if (_matched) exitWith {
  258. s_player_origins_unlock = player addAction [_openClose, "origins\player_lockUnlock.sqf", [_cursorTarget,_typeOfCursorTarget,_state]];
  259. };
  260. } count DZE_Origins_NameLookup;
  261. };
  262. } else {
  263. [2] call origins_removeActions;
  264. };
  265. } else {
  266. [0] call origins_removeActions;
  267. };
  268. };
  269.  
  270. //allow demolition of Origins Housing
  271. if (typeOf _vehicle =="ori_excavator") then
  272. {
  273. if (bucketOut < 0) then {
  274. bucketOut = _vehicle addAction ["Bucket Out","custom\build\bucketOut.sqf","",5,false,true];
  275. };
  276. if(bucketIn < 0) then {
  277. bucketIn = _vehicle addAction ["Bucket In","custom\build\bucketIn.sqf","",5,false,true];
  278. };
  279. _nearestBuildList = [];
  280. _nearestBuilding = "";
  281. _originHousing = DZE_Origins_Buildings;
  282. _nearestBuildList = nearestObjects [_vehicle, _originHousing, 20];
  283. _nearestBuilding = _nearestBuildList select 0;
  284.  
  285. if(!isNil "_nearestBuilding") then
  286. {
  287. _buildOwner = _nearestBuilding getVariable['OwnerUID','0'];
  288.  
  289. if(s_demolish < 0) then {
  290. if (_buildOwner == (getplayerUID player)) then {
  291. s_demolish = _vehicle addaction [("<t color=""#ff0000"">" + format["Demolish %1",typeOf(_nearestBuilding)] +"</t>"),"custom\build\demolish.sqf",_nearestBuilding,6,false,true,"",""];
  292. sleep 5;
  293. };
  294. } else {
  295. _vehicle removeAction s_demolish;
  296. s_demolish = -1;
  297. };
  298. } else {
  299. if(!isNil "player") then {
  300. _vehicle removeAction s_demolish;
  301. s_demolish = -1;
  302. };
  303. };
  304. } else {
  305. _vehicle removeAction bucketIn;
  306. bucketIn = -1;
  307. _vehicle removeAction bucketOut;
  308. bucketOut = -1;
  309. _vehicle removeAction s_demolish;
  310. s_demolish = -1;
  311. };
  312.  
  313. //Submarine Submerging
  314. if (typeOf _vehicle == "ori_submarine" && surfaceIsWater position player) then {
  315.  
  316. if ((_vehicle animationPhase "sink") == 1) then {
  317. if (sub_Up < 0) then {
  318. sub_Up = _vehicle addAction ["Rise","scripts\sub_UPDown.sqf",0,5,false,true];
  319. };
  320. } else {
  321. if (sub_down < 0) then {
  322. sub_Down = _vehicle addAction ["Submerge","scripts\sub_UPDown.sqf",1,5,false,true];
  323. };
  324. };
  325. } else {
  326. _vehicle removeAction sub_Up;
  327. sub_Up = -1;
  328. _vehicle removeAction sub_Down;
  329. sub_Down = -1;
  330. };
  331.  
  332.  
  333. if(_isPZombie) then {
  334. if (s_player_callzombies < 0) then {
  335. s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  336. };
  337. if (DZE_PZATTACK) then {
  338. call pz_attack;
  339. DZE_PZATTACK = false;
  340. };
  341. if (s_player_pzombiesvision < 0) then {
  342. 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"];
  343. };
  344. if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target
  345. _isAnimal = cursorTarget isKindOf "Animal";
  346. _isZombie = cursorTarget isKindOf "zZombie_base";
  347. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  348. _isMan = cursorTarget isKindOf "Man";
  349. // Pzombie Gut human corpse || animal
  350. if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
  351. if (s_player_pzombiesfeed < 0) then {
  352. s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  353. };
  354. } else {
  355. player removeAction s_player_pzombiesfeed;
  356. s_player_pzombiesfeed = -1;
  357. };
  358. } else {
  359. player removeAction s_player_pzombiesfeed;
  360. s_player_pzombiesfeed = -1;
  361. };
  362. };
  363.  
  364. // Increase distance only if AIR || SHIP
  365. _allowedDistance = 4;
  366. _isAir = cursorTarget isKindOf "Air";
  367. _isShip = cursorTarget isKindOf "Ship";
  368. if(_isAir || _isShip) then {
  369. _allowedDistance = 8;
  370. };
  371.  
  372. if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then { //Has some kind of target
  373.  
  374. // set cursortarget to variable
  375. _cursorTarget = cursorTarget;
  376.  
  377. // get typeof cursortarget once
  378. _typeOfCursorTarget = typeOf _cursorTarget;
  379.  
  380. // hintsilent _typeOfCursorTarget;
  381.  
  382. _isVehicle = _cursorTarget isKindOf "AllVehicles";
  383. _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  384. _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
  385.  
  386. // get items && magazines only once
  387. _magazinesPlayer = magazines player;
  388.  
  389. //boiled Water
  390. _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
  391. _hastinitem = false;
  392. {
  393. if (_x in _magazinesPlayer) then {
  394. _hastinitem = true;
  395. };
  396. } count boil_tin_cans;
  397. _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;
  398. _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;
  399. _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
  400.  
  401. _itemsPlayer = items player;
  402.  
  403. _temp_keys = [];
  404. _temp_keys_names = [];
  405. // find available keys
  406. _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  407. {
  408. if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
  409. _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
  410. _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
  411. _temp_keys_names set [_ownerKeyId,_ownerKeyName];
  412. _temp_keys set [count _temp_keys,str(_ownerKeyId)];
  413. };
  414. } count _itemsPlayer;
  415.  
  416. _hasKnife = "ItemKnife" in _itemsPlayer;
  417. _hasToolbox = "ItemToolbox" in _itemsPlayer;
  418.  
  419. if (DZE_APlotforLife) then {
  420. _playerUID = [player] call FNC_GetPlayerUID;
  421. }else{
  422. _playerUID = dayz_characterID;
  423. };
  424.  
  425. _isMan = _cursorTarget isKindOf "Man";
  426. _traderType = _typeOfCursorTarget;
  427. _ownerID = _cursorTarget getVariable ["ownerPUID","0"];
  428. _characterID = _cursorTarget getVariable ["CharacterID","0"];
  429. _isAnimal = _cursorTarget isKindOf "Animal";
  430. _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
  431. _isZombie = _cursorTarget isKindOf "zZombie_base";
  432. _isDestructable = _cursorTarget isKindOf "BuiltItems";
  433. _isWreck = _typeOfCursorTarget in DZE_isWreck;
  434. _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
  435. _isModular = _cursorTarget isKindOf "ModularItems";
  436. _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
  437.  
  438. _isRemovable = _typeOfCursorTarget in DZE_isRemovable;
  439. _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];
  440.  
  441. _isTent = _cursorTarget isKindOf "TentStorage";
  442.  
  443. _isAlive = alive _cursorTarget;
  444.  
  445. _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
  446.  
  447. _rawmeat = meatraw;
  448. _hasRawMeat = false;
  449. {
  450. if (_x in _magazinesPlayer) then {
  451. _hasRawMeat = true;
  452. };
  453. } count _rawmeat;
  454.  
  455. _isFuel = false;
  456. if (_hasFuelE || _hasFuelBarrelE) then {
  457. {
  458. if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
  459. } count dayz_fuelsources;
  460. };
  461.  
  462. // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  463.  
  464. // logic vars
  465. _player_flipveh = false;
  466. _player_deleteBuild = false;
  467. _player_lockUnlock_crtl = false;
  468.  
  469. if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
  470. if (s_player_plotManagement < 0) then {
  471. _adminList = ["0152"]; // Add admins here if you admins to able to manage all plotpoles
  472. _owner = _cursorTarget getVariable ["ownerPUID","0"];
  473. _friends = _cursorTarget getVariable ["plotfriends", []];
  474. _fuid = [];
  475. {
  476. _friendUID = _x select 0;
  477. _fuid = _fuid + [_friendUID];
  478. } forEach _friends;
  479. _allowed = [_owner];
  480. _allowed = [_owner] + _adminList + _fuid;
  481. if((getPlayerUID player) in _allowed)then{
  482. s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "scripts\plotManagement\initPlotManagement.sqf", [], 5, false];
  483. };
  484. };
  485. if (s_player_maintain_area < 0) then {
  486. s_player_maintain_area = player addAction [format[], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];
  487. s_player_maintain_area_preview = player addAction [format[], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
  488. };
  489.  
  490. _plotDistance = (DZE_PlotPole select 0);
  491. _PlotsmarkersNear = count (nearestObjects [_cursorTarget, ["Land_coneLight"], _PlotDistance]);
  492.  
  493. if (s_player_plot_boundary_on < 0) then {
  494. If (_PlotsmarkersNear == 0 ) then{
  495. s_player_plot_boundary_on = player addAction ["Show plot boundary", "Custom\A_Plot_for_Life\Action\object_showPlotRadius.sqf", "", 1, false];
  496. };
  497. };
  498. if (s_player_plot_boundary_off < 0) then {
  499. If (_PlotsmarkersNear > 0 ) then{
  500. s_player_plot_boundary_off = player addAction ["Remove plot boundary", "Custom\A_Plot_for_Life\Action\object_removePlotRadius.sqf", "", 1, false];
  501. };
  502. };
  503. if (s_player_plot_take_ownership < 0) then {
  504. if (DZE_PlotOwnership) then {
  505. _isowner = [player, _cursorTarget] call FNC_check_owner;
  506. If (( _isowner select 0 )) then{
  507. s_player_plot_take_ownership = player addAction ["Take plot items ownership", "Custom\A_Plot_for_Life\Action\plot_take_ownership.sqf", "", 1, false];
  508. };
  509. };
  510. };
  511. } else {
  512. player removeAction s_player_plotManagement;
  513. s_player_plotManagement = -1;
  514. player removeAction s_player_maintain_area;
  515. s_player_maintain_area = -1;
  516. player removeAction s_player_maintain_area_preview;
  517. s_player_maintain_area_preview = -1;
  518. player removeAction s_player_plot_boundary_on;
  519. s_player_plot_boundary_on = -1;
  520. player removeAction s_player_plot_boundary_off;
  521. s_player_plot_boundary_off = -1;
  522. player removeAction s_player_plot_take_ownership;
  523. s_player_plot_take_ownership = -1;
  524. };
  525.  
  526. // CURSOR TARGET ALIVE
  527. if(_isAlive) then {
  528.  
  529. //Allow player to delete objects
  530. if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
  531. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  532. _player_deleteBuild = true;
  533. };
  534. };
  535.  
  536. ///Allow owners to delete modulars
  537. if(_isModular) then {
  538. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  539. _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
  540. _IsNearPlot = count (_findNearestPoles);
  541. _fuid = [];
  542. _allowed = [];
  543. if(_IsNearPlot > 0)then{
  544. _thePlot = _findNearestPoles select 0;
  545. _owner = _thePlot getVariable ["ownerPUID","010"];
  546. _friends = _thePlot getVariable ["plotfriends", []];
  547. {
  548. _friendUID = _x select 0;
  549. _fuid = _fuid + [_friendUID];
  550. } forEach _friends;
  551. _allowed = [_owner];
  552. _allowed = [_owner] + _fuid;
  553. if ( _playerUID in _allowed && _ownerID in _allowed ) then {
  554. _player_deleteBuild = true;
  555. };
  556. }else{
  557. if(_ownerID == _playerUID)then{
  558. _player_deleteBuild = true;
  559. };
  560. };
  561. };
  562. };
  563. //Allow owners to delete modular doors without locks
  564. if(_isModularDoor) then {
  565. if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
  566. _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
  567. _IsNearPlot = count (_findNearestPoles);
  568. _fuid = [];
  569. _allowed = [];
  570. if(_IsNearPlot > 0)then{
  571. _thePlot = _findNearestPoles select 0;
  572. _owner = _thePlot getVariable ["ownerPUID","010"];
  573. _friends = _thePlot getVariable ["plotfriends", []];
  574. {
  575. _friendUID = _x select 0;
  576. _fuid = _fuid + [_friendUID];
  577. } forEach _friends;
  578. _allowed = [_owner];
  579. _allowed = [_owner] + _fuid;
  580. if ( _playerUID in _allowed && _ownerID in _allowed) then {
  581. _player_deleteBuild = true;
  582. };
  583. }else{
  584. if(_ownerID == _playerUID)then{
  585. _player_deleteBuild = true;
  586. };
  587. };
  588. };
  589. };
  590. // CURSOR TARGET VEHICLE
  591. if(_isVehicle) then {
  592.  
  593. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  594. if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
  595. _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
  596. if(_isVehicletype || (_playersNear >= 2)) then {
  597. _player_flipveh = true;
  598. };
  599. };
  600.  
  601.  
  602. if(!_isMan && _characterID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
  603. _player_lockUnlock_crtl = true;
  604. };
  605.  
  606. };
  607.  
  608. };
  609.  
  610. if(_player_deleteBuild) then {
  611. if (s_player_deleteBuild < 0) then {
  612. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "Custom\A_Plot_for_Life\Action\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  613. };
  614. } else {
  615. player removeAction s_player_deleteBuild;
  616. s_player_deleteBuild = -1;
  617. };
  618.  
  619. if (DZE_HeliLift) then {
  620. _liftHeli = objNull;
  621. _found = false;
  622.  
  623. _allowTow = false;
  624. if ((count (crew _cursorTarget)) == 0) then {
  625. {
  626. if(!_allowTow) then {
  627. _allowTow = _cursorTarget isKindOf _x;
  628. };
  629. } count DZE_HeliAllowToTow;
  630. };
  631.  
  632. //diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow];
  633.  
  634. if (_allowTow) then {
  635. _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15];
  636. {
  637. if(!_found) then {
  638. _posL = [_x] call FNC_getPos;
  639. _posC = [_cursorTarget] call FNC_getPos;
  640. _height = (_posL select 2) - (_posC select 2);
  641. _hasAttached = _x getVariable["hasAttached",false];
  642. if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {
  643. if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
  644. _liftHeli = _x;
  645. _found = true;
  646. };
  647. };
  648. };
  649. } count _liftHelis;
  650. };
  651.  
  652. //diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget];
  653.  
  654. _attached = _cursorTarget getVariable["attached",false];
  655. if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {
  656. if (s_player_heli_lift < 0) then {
  657. s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];
  658. };
  659. } else {
  660. player removeAction s_player_heli_lift;
  661. s_player_heli_lift = -1;
  662. };
  663. };
  664.  
  665. // Allow Owner to lock && unlock vehicle
  666. if(_player_lockUnlock_crtl) then {
  667. if (s_player_lockUnlock_crtl < 0) then {
  668. _hasKey = _characterID in _temp_keys;
  669. _oldOwner = (_characterID == dayz_playerUID);
  670. if(locked _cursorTarget) then {
  671. if(_hasKey || _oldOwner) then {
  672. _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true, "", ""];
  673. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  674. s_player_lockUnlock_crtl = 1;
  675. } else {
  676. if(_hasHotwireKit) then {
  677. _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
  678. } else {
  679. _Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];
  680. };
  681. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  682. s_player_lockUnlock_crtl = 1;
  683. };
  684. } else {
  685. if(_hasKey || _oldOwner) then {
  686. _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
  687. s_player_lockunlock set [count s_player_lockunlock,_lock];
  688. s_player_lockUnlock_crtl = 1;
  689. };
  690. };
  691. };
  692.  
  693. } else {
  694. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  695. s_player_lockUnlock_crtl = -1;
  696. };
  697.  
  698. if(DZE_AllowForceSave) then {
  699. //Allow player to force save
  700. if((_isVehicle || _isTent) && !_isMan) then {
  701. if (s_player_forceSave < 0) then {
  702. s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
  703. };
  704. } else {
  705. player removeAction s_player_forceSave;
  706. s_player_forceSave = -1;
  707. };
  708. };
  709.  
  710.  
  711.  
  712. If(DZE_AllowCargoCheck) then {
  713. if((_isVehicle || _isTent || _isnewstorage || _typeOfCursorTarget in DZE_Origins_Buildings) && _isAlive && !_isMan && !locked _cursorTarget) then { if (s_player_checkGear < 0) then {
  714.  
  715. s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
  716. };
  717. } else {
  718. player removeAction s_player_checkGear;
  719. s_player_checkGear = -1;
  720. };
  721. };
  722.  
  723.  
  724. //flip vehicle small vehicles by your self && all other vehicles with help nearby
  725. if(_player_flipveh) then {
  726. if (s_player_flipveh < 0) then {
  727. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];
  728. };
  729. } else {
  730. player removeAction s_player_flipveh;
  731. s_player_flipveh = -1;
  732. };
  733.  
  734. //Allow player to fill jerrycan
  735. if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
  736. if (s_player_fillfuel < 0) then {
  737. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  738. };
  739. } else {
  740. player removeAction s_player_fillfuel;
  741. s_player_fillfuel = -1;
  742. };
  743.  
  744. // logic vars for addactions
  745. _player_butcher = false;
  746. _player_studybody = false;
  747. _player_SurrenderedGear = false;
  748.  
  749. if ( cursorTarget isKindOf "GraveDZE") then {
  750. _player_studybody = true;
  751. };
  752.  
  753. // CURSOR TARGET NOT ALIVE
  754. if (!_isAlive) then {
  755.  
  756. // Gut animal/zed
  757. if((_isAnimal || _isZombie) && _hasKnife) then {
  758. _isHarvested = _cursorTarget getVariable["meatHarvested",false];
  759. if (!_isHarvested) then {
  760. _player_butcher = true;
  761. };
  762. };
  763.  
  764. // Study body
  765. if (_isMan && !_isZombie && !_isAnimal) then {
  766. _player_studybody = true;
  767. }
  768. } else {
  769. // unit alive
  770.  
  771. // gear access on surrendered player
  772. if(_isMan && !_isZombie && !_isAnimal) then {
  773. _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
  774. if (_isSurrendered) then {
  775. _player_SurrenderedGear = true;
  776. };
  777. };
  778. };
  779.  
  780.  
  781. // Human Gut animal || zombie
  782. if (_player_butcher) then {
  783. if (s_player_butcher < 0) then {
  784. if(_isZombie) then {
  785. s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
  786. } else {
  787. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
  788. };
  789. };
  790. } else {
  791. player removeAction s_player_butcher;
  792. s_player_butcher = -1;
  793. };
  794.  
  795. // Study Body
  796. if (_player_studybody) then {
  797. if (s_player_studybody < 0) then {
  798. s_player_studybody = player addAction [("<t color=""#FF0000"">"+("Check Wallet") + "</t>"), "ZSC\actions\check_wallet.sqf",_cursorTarget, 0, false, true, "",""];
  799. };
  800. } else {
  801. player removeAction s_player_studybody;
  802. s_player_studybody = -1;
  803. };
  804.  
  805. //Remove CLOTHES
  806. if (_isMan and !_isAlive and !_isZombie and !_isAnimal) then {
  807. if (s_clothes < 0) then {
  808. s_clothes = player addAction [("" + ("Take Clothes") + ""), "scripts\skins\removeclothes.sqf",cursorTarget, 1, false, true, "",""];
  809. };
  810. } else {
  811. player removeAction s_clothes;
  812. s_clothes = -1;
  813. };
  814.  
  815. // logic vars
  816. _player_cook = false;
  817. _player_boil = false;
  818.  
  819. // CURSOR TARGET IS FIRE
  820. if (inflamed _cursorTarget) then {
  821.  
  822. //Fireplace Actions check
  823. if (_hasRawMeat) then {
  824. _player_cook = true;
  825. };
  826.  
  827. // Boil water
  828. if (_hasbottleitem && _hastinitem) then {
  829. _player_boil = true;
  830. };
  831. };
  832.  
  833. if (_player_SurrenderedGear) then {
  834. if (s_player_SurrenderedGear < 0) then {
  835. s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
  836. };
  837. } else {
  838. player removeAction s_player_SurrenderedGear;
  839. s_player_SurrenderedGear = -1;
  840. };
  841.  
  842. //Fireplace Actions check
  843. if (_player_cook) then {
  844. if (s_player_cook < 0) then {
  845. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
  846. };
  847. } else {
  848. player removeAction s_player_cook;
  849. s_player_cook = -1;
  850. };
  851.  
  852. // Boil water
  853. if (_player_boil) then {
  854. if (s_player_boil < 0) then {
  855. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
  856. };
  857. } else {
  858. player removeAction s_player_boil;
  859. s_player_boil = -1;
  860. };
  861.  
  862. if(_cursorTarget == dayz_hasFire) then {
  863. if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
  864. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
  865. };
  866. } else {
  867. player removeAction s_player_fireout;
  868. s_player_fireout = -1;
  869. };
  870.  
  871. //Packing my tent
  872. if(_isTent && (player distance _cursorTarget < 3)) then {
  873. if (_ownerID == _playerUID) then {
  874. if (s_player_packtent < 0) then {
  875. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
  876. };
  877. } else {
  878. if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
  879. if (s_player_packtent < 0) then {
  880. s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "Custom\A_Plot_for_Life\Action\remove.sqf",_cursorTarget, 1, true, true, "", ""];
  881. };
  882. };
  883. };
  884. } else {
  885. player removeAction s_player_packtent;
  886. s_player_packtent = -1;
  887. };
  888.  
  889. //Allow manage door
  890. if((_typeOfCursorTarget in DZE_DoorsLocked)) then {
  891. if (s_player_manageDoor < 0) then {
  892. s_player_manageDoor = player addAction ["<t color='#0059FF'>Manage Door</t>", "scripts\doorManagement\initDoorManagement.sqf", _cursorTarget, 5, false];
  893. };
  894. } else {
  895. player removeAction s_player_manageDoor;
  896. s_player_manageDoor = -1;
  897. };
  898.  
  899. //Allow owner to unlock vault
  900. if((_typeOfCursorTarget in DZE_LockableStorage) && _characterID != "0" && (player distance _cursorTarget < 3)) then {
  901. if (s_player_unlockvault < 0) then {
  902. if(_typeOfCursorTarget in DZE_LockedStorage) then {
  903. if(_characterID == dayz_combination || _ownerID == _playerUID) then {
  904. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
  905. s_player_combi set [count s_player_combi,_combi];
  906. } else {
  907. _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  908. s_player_combi set [count s_player_combi,_combi];
  909. };
  910. s_player_unlockvault = 1;
  911. } else {
  912. if(_characterID != dayz_combination && _ownerID != _playerUID) then {
  913. _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
  914. s_player_combi set [count s_player_combi,_combi];
  915. s_player_unlockvault = 1;
  916. };
  917. };
  918. };
  919. } else {
  920. {player removeAction _x} count s_player_combi;s_player_combi = [];
  921. s_player_unlockvault = -1;
  922. };
  923.  
  924. if(_typeOfCursorTarget in ZSC_MoneyStorage && (player distance _cursorTarget < 5)) then {
  925. if (s_bank_dialog < 0) then {
  926. s_bank_dialog = player addAction ["Money Storage", "ZSC\actions\bank_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
  927. };
  928. } else {
  929. player removeAction s_bank_dialog;
  930. s_bank_dialog = -1;
  931. };
  932.  
  933. // cars
  934. if( _isVehicle && !_isMan &&_isAlive && !_isMan && !locked _cursorTarget && !(_cursorTarget isKindOf "Bicycle") && (player distance _cursorTarget < 5)) then {
  935. if (s_bank_dialog2 < 0) then {
  936. s_bank_dialog2 = player addAction ["Money Storage", "ZSC\actions\bank_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
  937. };
  938. } else {
  939. player removeAction s_bank_dialog2;
  940. s_bank_dialog2 = -1;
  941. };
  942. //Allow owner to pack vault
  943. if(_typeOfCursorTarget in DZE_UnLockedStorage && _characterID != "0" && (player distance _cursorTarget < 3)) then {
  944.  
  945. if (s_player_lockvault < 0) then {
  946. if(_characterID == dayz_combination || _ownerID == dayz_playerUID) then {
  947. s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
  948. };
  949. };
  950. if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == dayz_playerUID)) then {
  951. 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, "",""];
  952. };
  953. } else {
  954. player removeAction s_player_packvault;
  955. s_player_packvault = -1;
  956. player removeAction s_player_lockvault;
  957. s_player_lockvault = -1;
  958. };
  959.  
  960.  
  961.  
  962. //Player Deaths
  963. if(_typeOfCursorTarget == "Info_Board_EP1") then {
  964. if (s_player_information < 0) then {
  965. s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
  966. };
  967. } else {
  968. player removeAction s_player_information;
  969. s_player_information = -1;
  970. };
  971.  
  972. if (_isMan and _isAlive and !_isZombie and !_isAnimal and !(_traderType in serverTraders)) then {
  973. if (s_givemoney_dialog < 0) then {
  974. s_givemoney_dialog = player addAction [format["Give Money to %1", (name _cursorTarget)], "ZSC\actions\give_player_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
  975. };
  976. } else {
  977. player removeAction s_givemoney_dialog;
  978. s_givemoney_dialog = -1;
  979. };
  980. //Fuel Pump
  981. if(_typeOfCursorTarget in dayz_fuelpumparray) then {
  982. if (s_player_fuelauto < 0) then {
  983.  
  984. // check if Generator_DZ is running within 30 meters
  985. _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
  986. _findNearestGen = [];
  987. {
  988. if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
  989. _findNearestGen set [(count _findNearestGen),_x];
  990. };
  991. } count _findNearestGens;
  992. _IsNearRunningGen = count (_findNearestGen);
  993.  
  994. // show that pump needs power if no generator nearby.
  995. if(_IsNearRunningGen > 0) then {
  996. s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
  997. } else {
  998. s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  999. };
  1000. };
  1001. } else {
  1002. player removeAction s_player_fuelauto;
  1003. s_player_fuelauto = -1;
  1004. };
  1005.  
  1006. //Fuel Pump on truck
  1007. if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {
  1008. if (s_player_fuelauto2 < 0) then {
  1009. // show that fuel truck pump needs power.
  1010. if(isEngineOn _cursorTarget) then {
  1011. s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
  1012. } else {
  1013. s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
  1014. };
  1015. };
  1016. } else {
  1017. player removeAction s_player_fuelauto2;
  1018. s_player_fuelauto2 = -1;
  1019. };
  1020.  
  1021. // inplace upgrade tool
  1022. if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
  1023. if ((s_player_lastTarget select 0) != _cursorTarget) then {
  1024. if (s_player_upgrade_build > 0) then {
  1025. player removeAction s_player_upgrade_build;
  1026. s_player_upgrade_build = -1;
  1027. };
  1028. };
  1029. if (s_player_upgrade_build < 0) then {
  1030. // s_player_lastTarget = _cursorTarget;
  1031. s_player_lastTarget set [0,_cursorTarget];
  1032. s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "Custom\A_Plot_for_Life\Action\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
  1033. };
  1034. } else {
  1035. player removeAction s_player_upgrade_build;
  1036. s_player_upgrade_build = -1;
  1037. };
  1038.  
  1039. // downgrade system
  1040. if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _characterID)) then {
  1041. if ((s_player_lastTarget select 1) != _cursorTarget) then {
  1042. if (s_player_downgrade_build > 0) then {
  1043. player removeAction s_player_downgrade_build;
  1044. s_player_downgrade_build = -1;
  1045. };
  1046. };
  1047.  
  1048. if (s_player_downgrade_build < 0) then {
  1049. s_player_lastTarget set [1,_cursorTarget];
  1050. s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "Custom\A_Plot_for_Life\Action\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];
  1051. };
  1052. } else {
  1053. player removeAction s_player_downgrade_build;
  1054. s_player_downgrade_build = -1;
  1055. };
  1056.  
  1057. // inplace maintenance tool
  1058. if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
  1059. if ((s_player_lastTarget select 2) != _cursorTarget) then {
  1060. if (s_player_maint_build > 0) then {
  1061. player removeAction s_player_maint_build;
  1062. s_player_maint_build = -1;
  1063. };
  1064. };
  1065.  
  1066. if (s_player_maint_build < 0) then {
  1067. s_player_lastTarget set [2,_cursorTarget];
  1068. 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, "",""];
  1069. };
  1070. } else {
  1071. player removeAction s_player_maint_build;
  1072. s_player_maint_build = -1;
  1073. };
  1074.  
  1075.  
  1076. //Start Generator
  1077. if(_cursorTarget isKindOf "Generator_DZ") then {
  1078. if (s_player_fillgen < 0) then {
  1079.  
  1080. // check if not running
  1081. if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
  1082. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  1083. } else {
  1084. // check if not filled && player has jerry.
  1085. if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
  1086. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  1087. } else {
  1088. if("ItemJerrycan" in _magazinesPlayer) then {
  1089. s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
  1090. };
  1091. };
  1092. };
  1093. };
  1094. } else {
  1095. player removeAction s_player_fillgen;
  1096. s_player_fillgen = -1;
  1097. };
  1098.  
  1099. //Towing with tow truck
  1100. /*
  1101. if(_typeOfCursorTarget == "TOW_DZE") then {
  1102. if (s_player_towing < 0) then {
  1103. if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
  1104. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  1105. } else {
  1106. s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];
  1107. };
  1108. };
  1109. } else {
  1110. player removeAction s_player_towing;
  1111. s_player_towing = -1;
  1112. };
  1113. */
  1114.  
  1115.  
  1116. //Sleep
  1117. if(_isTent && _ownerID == _playerUID) then {
  1118. if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
  1119. s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
  1120. };
  1121. } else {
  1122. player removeAction s_player_sleep;
  1123. s_player_sleep = -1;
  1124. };
  1125.  
  1126. //Repairing Vehicles
  1127. if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
  1128. if (s_player_repair_crtl < 0) then {
  1129. dayz_myCursorTarget = _cursorTarget;
  1130. _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  1131. _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
  1132. s_player_repairActions set [count s_player_repairActions,_menu];
  1133. s_player_repairActions set [count s_player_repairActions,_menu1];
  1134. s_player_repair_crtl = 1;
  1135. } else {
  1136. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  1137. s_player_repair_crtl = -1;
  1138. };
  1139. };
  1140.  
  1141. // All Traders
  1142. if (_isMan && !_isPZombie && _traderType in serverTraders) then {
  1143.  
  1144. if (s_player_parts_crtl < 0) then {
  1145.  
  1146. // get humanity
  1147. _humanity = player getVariable ["humanity",0];
  1148. _traderMenu = call compile format["menu_%1;",_traderType];
  1149.  
  1150. // diag_log ("TRADER = " + str(_traderMenu));
  1151.  
  1152. _low_high = "low";
  1153. _humanity_logic = false;
  1154. if((_traderMenu select 2) == "friendly") then {
  1155. _humanity_logic = (_humanity < -5000);
  1156. };
  1157. if((_traderMenu select 2) == "hostile") then {
  1158. _low_high = "high";
  1159. _humanity_logic = (_humanity > -5000);
  1160. };
  1161. if((_traderMenu select 2) == "hero") then {
  1162. _humanity_logic = (_humanity < 5000);
  1163. };
  1164. if(_humanity_logic) then {
  1165. _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
  1166. s_player_parts set [count s_player_parts,_cancel];
  1167. } else {
  1168.  
  1169. // Static Menu
  1170. {
  1171. //diag_log format["DEBUG TRADER: %1", _x];
  1172. _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, "",""];
  1173. s_player_parts set [count s_player_parts,_buy];
  1174.  
  1175. } count (_traderMenu select 1);
  1176. _buyV = player addAction ["<t color='#0059FF'>Advanced Trading</t>", "scripts\advancedTrading\init.sqf",(_traderMenu select 0), 999, true, false, "",""];
  1177. s_player_parts set [count s_player_parts,_buyV];
  1178. // Database menu
  1179. _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
  1180. s_player_parts set [count s_player_parts,_buy];
  1181.  
  1182. };
  1183. s_player_parts_crtl = 1;
  1184.  
  1185. };
  1186. } else {
  1187. {player removeAction _x} count s_player_parts;s_player_parts = [];
  1188. s_player_parts_crtl = -1;
  1189. };
  1190.  
  1191.  
  1192. if(dayz_tameDogs) then {
  1193.  
  1194. //Dog
  1195. if (_isDog && _isAlive && (_hasRawMeat) && _characterID == "0" && player getVariable ["dogID", 0] == 0) then {
  1196. if (s_player_tamedog < 0) then {
  1197. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
  1198. };
  1199. } else {
  1200. player removeAction s_player_tamedog;
  1201. s_player_tamedog = -1;
  1202. };
  1203. if (_isDog && _characterID == dayz_characterID && _isAlive) then {
  1204. _dogHandle = player getVariable ["dogID", 0];
  1205. if (s_player_feeddog < 0 && _hasRawMeat) then {
  1206. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  1207. };
  1208. if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
  1209. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  1210. };
  1211. if (s_player_staydog < 0) then {
  1212. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  1213. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  1214. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  1215. };
  1216. if (s_player_trackdog < 0) then {
  1217. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  1218. };
  1219. if (s_player_barkdog < 0) then {
  1220. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
  1221. };
  1222. if (s_player_warndog < 0) then {
  1223. _warn = _dogHandle getFSMVariable "_watchDog";
  1224. if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
  1225. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  1226. };
  1227. if (s_player_followdog < 0) then {
  1228. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  1229. };
  1230. } else {
  1231. player removeAction s_player_feeddog;
  1232. s_player_feeddog = -1;
  1233. player removeAction s_player_waterdog;
  1234. s_player_waterdog = -1;
  1235. player removeAction s_player_staydog;
  1236. s_player_staydog = -1;
  1237. player removeAction s_player_trackdog;
  1238. s_player_trackdog = -1;
  1239. player removeAction s_player_barkdog;
  1240. s_player_barkdog = -1;
  1241. player removeAction s_player_warndog;
  1242. s_player_warndog = -1;
  1243. player removeAction s_player_followdog;
  1244. s_player_followdog = -1;
  1245. };
  1246. };
  1247.  
  1248. } else {
  1249. //Engineering
  1250.  
  1251. player removeAction s_player_plotManagement;
  1252. s_player_plotManagement = -1;
  1253. {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
  1254. s_player_repair_crtl = -1;
  1255.  
  1256. {player removeAction _x} count s_player_combi;s_player_combi = [];
  1257.  
  1258. dayz_myCursorTarget = objNull;
  1259. s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
  1260.  
  1261. {player removeAction _x} count s_player_parts;s_player_parts = [];
  1262. s_player_parts_crtl = -1;
  1263.  
  1264. {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
  1265. s_player_lockUnlock_crtl = -1;
  1266.  
  1267. player removeAction s_player_checkGear;
  1268. s_player_checkGear = -1;
  1269.  
  1270. player removeAction s_player_SurrenderedGear;
  1271. s_player_SurrenderedGear = -1;
  1272.  
  1273. //Others
  1274. player removeAction s_player_maintain_area;
  1275. s_player_maintain_area = -1;
  1276. player removeAction s_player_maintain_area_preview;
  1277. s_player_maintain_area_preview = -1;
  1278. player removeAction s_player_plot_boundary_on;
  1279. s_player_plot_boundary_on = -1;
  1280. player removeAction s_player_plot_boundary_off;
  1281. s_player_plot_boundary_off = -1;
  1282. player removeAction s_player_plot_take_ownership;
  1283. s_player_plot_take_ownership = -1;
  1284. player removeAction s_player_forceSave;
  1285. s_player_forceSave = -1;
  1286. player removeAction s_player_flipveh;
  1287. s_player_flipveh = -1;
  1288. player removeAction s_player_sleep;
  1289. s_player_sleep = -1;
  1290. player removeAction s_player_deleteBuild;
  1291. s_player_deleteBuild = -1;
  1292. player removeAction s_player_butcher;
  1293. s_player_butcher = -1;
  1294. player removeAction s_player_cook;
  1295. s_player_cook = -1;
  1296. player removeAction s_player_boil;
  1297. s_player_boil = -1;
  1298. player removeAction s_player_fireout;
  1299. s_player_fireout = -1;
  1300. player removeAction s_player_packtent;
  1301. s_player_packtent = -1;
  1302. player removeAction s_player_fillfuel;
  1303. s_player_fillfuel = -1;
  1304. player removeAction s_player_studybody;
  1305. s_player_studybody = -1;
  1306. //Dog
  1307. player removeAction s_player_tamedog;
  1308. s_player_tamedog = -1;
  1309. player removeAction s_player_feeddog;
  1310. s_player_feeddog = -1;
  1311. player removeAction s_player_waterdog;
  1312. s_player_waterdog = -1;
  1313. player removeAction s_player_staydog;
  1314. s_player_staydog = -1;
  1315. player removeAction s_player_trackdog;
  1316. s_player_trackdog = -1;
  1317. player removeAction s_player_barkdog;
  1318. s_player_barkdog = -1;
  1319. player removeAction s_player_warndog;
  1320. s_player_warndog = -1;
  1321. player removeAction s_player_followdog;
  1322. s_player_followdog = -1;
  1323.  
  1324. // vault
  1325. player removeAction s_player_unlockvault;
  1326. s_player_unlockvault = -1;
  1327. player removeAction s_player_packvault;
  1328. s_player_packvault = -1;
  1329. player removeAction s_player_lockvault;
  1330. s_player_lockvault = -1;
  1331.  
  1332. player removeAction s_player_information;
  1333. s_player_information = -1;
  1334. player removeAction s_player_fillgen;
  1335. s_player_fillgen = -1;
  1336. player removeAction s_player_upgrade_build;
  1337. s_player_upgrade_build = -1;
  1338. player removeAction s_player_maint_build;
  1339. s_player_maint_build = -1;
  1340. player removeAction s_player_downgrade_build;
  1341. s_player_downgrade_build = -1;
  1342. player removeAction s_player_towing;
  1343. s_player_towing = -1;
  1344. player removeAction s_player_fuelauto;
  1345. s_player_fuelauto = -1;
  1346. player removeAction s_player_fuelauto2;
  1347. s_player_fuelauto2 = -1;
  1348. player removeAction s_givemoney_dialog;
  1349. s_givemoney_dialog = -1;
  1350. player removeAction s_bank_dialog;
  1351. s_bank_dialog = -1;
  1352. player removeAction s_bank_dialog2;
  1353. s_bank_dialog2 = -1;
  1354. player removeAction s_player_manageDoor;
  1355. s_player_manageDoor = -1;
  1356. player removeAction s_clothes;
  1357. s_clothes = -1;
  1358. };
  1359.  
  1360.  
  1361.  
  1362. //Dog actions on player self
  1363. _dogHandle = player getVariable ["dogID", 0];
  1364. if (_dogHandle > 0) then {
  1365. _dog = _dogHandle getFSMVariable "_dog";
  1366. _characterID = "0";
  1367. if (!isNull cursorTarget) then { _characterID = cursorTarget getVariable ["CharacterID","0"]; };
  1368. if (_canDo && !_inVehicle && alive _dog && _characterID != dayz_characterID) then {
  1369. if (s_player_movedog < 0) then {
  1370. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  1371. };
  1372. if (s_player_speeddog < 0) then {
  1373. _text = (localize "str_epoch_player_249");
  1374. _speed = 0;
  1375. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
  1376. 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, "", ""];
  1377. };
  1378. if (s_player_calldog < 0) then {
  1379. 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, "", ""];
  1380. };
  1381. };
  1382. } else {
  1383. player removeAction s_player_movedog;
  1384. s_player_movedog = -1;
  1385. player removeAction s_player_speeddog;
  1386. s_player_speeddog = -1;
  1387. player removeAction s_player_calldog;
  1388. s_player_calldog = -1;
  1389. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement