Advertisement
Guest User

Untitled

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