Advertisement
Guest User

Untitled

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