Advertisement
Guest User

Untitled

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