Guest User

fn_selfActions

a guest
May 30th, 2014
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.36 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["_isPZombie","_vehicle","_inVehicle","_bag","_classbag","_isWater","_hasAntiB","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_hasTent","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_canmove","_Unlock","_lock","_allFixed","_hitpoints","_damage","_part","_cmpt","_color","_string","_handle","_trader_id","_category","_buy","_buy2","_buy3","_buy1","_buy4","_buy5","_cantrader","_cantrader1","_buy6","_zparts1","_zparts2","_zparts3","_zparts4","_metals1","_metals2","_metals4","_metals3","_metals5","_dogHandle","_lieDown","_warn"];
  8.  
  9. _vehicle = vehicle player;
  10. _isPZombie = player isKindOf "PZombie_VB";
  11. _inVehicle = (_vehicle != player);
  12. _bag = unitBackpack player;
  13. _classbag = typeOf _bag;
  14. _isWater = (surfaceIsWater (position player)) or dayz_isSwimming;
  15. _hasAntiB = "ItemAntibiotic" in magazines player;
  16. _hasFuelE = "ItemJerrycanEmpty" in magazines player;
  17. //boiled Water
  18. _hasbottleitem = "ItemWaterbottle" in magazines player;
  19. _hastinitem = false;
  20.  
  21. {
  22. if (_x in magazines player) then {
  23. _hastinitem = true;
  24. };
  25. } forEach boil_tin_cans;
  26.  
  27. _hasKnife = "ItemKnife" in items player;
  28. _hasToolbox = "ItemToolbox" in items player;
  29. //_hasTent = "ItemTent" in items player;
  30. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  31. _nearLight = nearestObject [player,"LitObject"];
  32. _canPickLight = false;
  33.  
  34. if (!isNull _nearLight) then {
  35. if (_nearLight distance player < 4) then {
  36. _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
  37. };
  38. };
  39.  
  40. _isAirdrop = cursorTarget isKindOf "Notebook";
  41. if ((speed player <= 1) && _isAirdrop && _canDo && (player distance cursorTarget < 4)) then {
  42. if (s_player_Airdrop < 0) then {
  43. s_player_Airdrop = player addAction [("<t color=""#0096ff"">" + ("Fix Notebook (Airdrop)") +"</t>"),"Scripts\airdrop\Airdropp.sqf",cursorTarget, 0, false, true, "",""];
  44. };
  45. } else {
  46. player removeAction s_player_Airdrop;
  47. s_player_Airdrop = -1;
  48. };
  49.  
  50. _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
  51. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR IS TARGETING NOTHING) #####
  52. // #### START1 ####
  53. _currentSkin = typeOf(player);
  54. // Get closest camonet since we cannot target with crosshair Base Building Script, got lazy here, didnt fix with array
  55. camoNetB_East = nearestObject [player, "Land_CamoNetB_EAST"];
  56. camoNetVar_East = nearestObject [player, "Land_CamoNetVar_EAST"];
  57. camoNet_East = nearestObject [player, "Land_CamoNet_EAST"];
  58. camoNetB_Nato = nearestObject [player, "Land_CamoNetB_NATO"];
  59. camoNetVar_Nato = nearestObject [player, "Land_CamoNetVar_NATO"];
  60. camoNet_Nato = nearestObject [player, "Land_CamoNet_NATO"];
  61. // Check mags in player inventory to show build recipe menu
  62. _mags = magazines player;
  63. if ("ItemTankTrap" in _mags || "ItemSandbag" in _mags || "ItemWire" in _mags || "PartWoodPile" in _mags || "PartGeneric" in _mags) then {
  64. hasBuildItem = true;
  65. } else { hasBuildItem = false;};
  66. //Build Recipe Menu Action
  67. if((speed player <= 1) && hasBuildItem && _canDo) then {
  68. if (s_player_recipeMenu < 0) then {
  69. s_player_recipeMenu = player addaction [("<t color=""#0074E8"">" + ("Build Recipes") +"</t>"),"buildRecipeBook\build_recipe_dialog.sqf","",5,false,true,"",""];
  70. };
  71. } else {
  72. player removeAction s_player_recipeMenu;
  73. s_player_recipeMenu = -1;
  74. };
  75.  
  76. //Add in custom eventhandlers or whatever on skin change
  77. if (_currentSkin != globalSkin) then {
  78. globalSkin = _currentSkin;
  79. player removeMPEventHandler ["MPHit", 0];
  80. player removeEventHandler ["AnimChanged", 0];
  81. ehWall = player addEventHandler ["AnimChanged", { player call antiWall; } ];
  82. };
  83. // Remove CamoNets, (Not effecient but works)
  84. if((isNull cursorTarget) && _hasToolbox && _canDo && !remProc && !procBuild &&
  85. (camoNetB_East distance player < 10 or
  86. camoNetVar_East distance player < 10 or
  87. camoNet_East distance player < 10 or
  88. camoNetB_Nato distance player < 10 or
  89. camoNetVar_Nato distance player < 10 or
  90. camoNet_Nato distance player < 10)) then {
  91. if (s_player_deleteCamoNet < 0) then {
  92. s_player_deleteCamoNet = player addaction [("<t color=""#F01313"">" + ("Remove Netting") +"</t>"),"dayz_code\actions\player_remove.sqf","",1,true,true,"",""];
  93. };
  94. } else {
  95. player removeAction s_player_deleteCamoNet;
  96. s_player_deleteCamoNet = -1;
  97. };
  98.  
  99. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR IS TARGETING NOTHING) #####
  100. // #### END1 ####
  101. //Grab Flare
  102. if (_canPickLight and !dayz_hasLight and !_isPZombie) then {
  103. if (s_player_grabflare < 0) then {
  104. _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
  105. s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
  106. s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
  107. };
  108. } else {
  109. player removeAction s_player_grabflare;
  110. player removeAction s_player_removeflare;
  111. s_player_grabflare = -1;
  112. s_player_removeflare = -1;
  113. };
  114.  
  115. if(DZEdebug) then {
  116. hint str(typeOf cursorTarget);
  117.  
  118. if (s_player_debuglootpos < 0) then {
  119. s_player_debuglootpos = player addAction ["Save to arma2.rpt", "\z\addons\dayz_code\actions\debug\Make_lootPos.sqf", ["save"], 99, false, true, "",""];
  120. };
  121. };
  122.  
  123. if(_isPZombie) then {
  124. //_state = animationState player;
  125. //hint str(_state);
  126. if (s_player_callzombies < 0) then {
  127. s_player_callzombies = player addAction ["Raise Horde", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
  128. };
  129.  
  130. if (s_player_pzombiesattack < 0) then {
  131. s_player_pzombiesattack = player addAction ["Attack", "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf",cursorTarget, 6, true, false, "",""];
  132. };
  133.  
  134. if (!isNull cursorTarget and (player distance cursorTarget < 3)) then { //Has some kind of target
  135. _isAnimal = cursorTarget isKindOf "Animal";
  136. _isZombie = cursorTarget isKindOf "zZombie_base";
  137. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  138. _isMan = cursorTarget isKindOf "Man";
  139.  
  140. // Pzombie Gut human corpse or animal
  141. if (!alive cursorTarget and (_isAnimal or _isMan) and !_isZombie and !_isHarvested and _canDo) then {
  142. if (s_player_pzombiesfeed < 0) then {
  143. s_player_pzombiesfeed = player addAction ["Feed", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
  144. };
  145. } else {
  146. player removeAction s_player_pzombiesfeed;
  147. s_player_pzombiesfeed = -1;
  148. };
  149. } else {
  150. player removeAction s_player_pzombiesfeed;
  151. s_player_pzombiesfeed = -1;
  152. };
  153. };
  154.  
  155. // Increase distance only if AIR OR SHIP
  156. _allowedDistance = 4;
  157. _isAir = cursorTarget isKindOf "Air";
  158. _isShip = cursorTarget isKindOf "Ship";
  159. if(_isAir or _isShip) then {
  160. _allowedDistance = 6;
  161. };
  162.  
  163. if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cursorTarget < _allowedDistance)) then { //Has some kind of target
  164. _isHarvested = cursorTarget getVariable["meatHarvested",false];
  165. _isVehicle = cursorTarget isKindOf "AllVehicles";
  166. _isVehicletype = typeOf cursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
  167. _isMan = cursorTarget isKindOf "Man";
  168. _traderType = typeOf cursorTarget;
  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. _isTent = cursorTarget isKindOf "TentStorage";
  175. _isFuel = false;
  176. _isAlive = alive cursorTarget;
  177. _canmove = canmove cursorTarget;
  178. _text = getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName");
  179.  
  180.  
  181. _rawmeat = meatraw;
  182. _hasRawMeat = false;
  183. {
  184. if (_x in magazines player) then {
  185. _hasRawMeat = true;
  186. };
  187. } forEach _rawmeat;
  188.  
  189.  
  190. if (_hasFuelE) then {
  191. _isFuel = (cursorTarget isKindOf "Land_Ind_TankSmall") or (cursorTarget isKindOf "Land_fuel_tank_big") or (cursorTarget isKindOf "Land_fuel_tank_stairs") or (cursorTarget isKindOf "Land_fuel_tank_stairs_ep1") or (cursorTarget isKindOf "Land_wagon_tanker") or (cursorTarget isKindOf "Land_fuelstation") or (cursorTarget isKindOf "Land_fuelstation_army");
  192. };
  193. // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
  194. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR HAS A TARGET) #####
  195. // ##### START #####
  196. // Operate Gates
  197. if ((dayz_myCursorTarget != cursorTarget) && (cursorTarget isKindOf "Infostand_2_EP1") && keyValid) then {
  198. _lever = cursorTarget;
  199. {dayz_myCursorTarget removeAction _x} forEach s_player_gateActions;s_player_gateActions = [];
  200. dayz_myCursorTarget = _lever;
  201. _gates = nearestObjects [_lever, ["Concrete_Wall_EP1"], 100];
  202. if (count _gates > 0) then {
  203. _handle = dayz_myCursorTarget addAction ["Operate Gate", "dayz_code\external\keypad\fnc_keyPad\operate_gates.sqf", _lever, 1, false, true, "", ""];
  204. s_player_gateActions set [count s_player_gateActions,_handle];
  205. };
  206. };
  207.  
  208. // Remove Object Custom removal test
  209. if((typeOf(cursortarget) in allremovables) && _hasToolbox && _canDo && !remProc && !procBuild && !removeObject) then {
  210. if (s_player_deleteBuild < 0) then {
  211. s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "dayz_code\actions\player_remove.sqf",cursorTarget, 1, true, true, "", ""];
  212. };
  213. } else {
  214. player removeAction s_player_deleteBuild;
  215. s_player_deleteBuild = -1;
  216. };
  217.  
  218.  
  219. // Enter Code to Operate Gates Action
  220. if((speed player <= 1) && !keyValid && (typeOf(cursortarget) == "Infostand_2_EP1") && cursorTarget distance player < 5 && _canDo) then {
  221. if (s_player_enterCode < 0) then {
  222. s_player_enterCode = player addaction [("<t color=""#4DFF0D"">" + ("Enter Key Code to Operate Gate") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
  223. };
  224. } else {
  225. player removeAction s_player_enterCode;
  226. s_player_enterCode = -1;
  227. };
  228.  
  229. // Enter Code to remove object
  230. if((speed player <= 1) && !removeObject && (typeOf(cursortarget) in allbuildables_class) && cursorTarget distance player < 5 && _canDo) then {
  231. if (s_player_codeObject < 0) then {
  232. s_player_codeObject = player addaction [("<t color=""#8E11F5"">" + ("Enter Code of Object to remove") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
  233. };
  234. } else {
  235. player removeAction s_player_codeObject;
  236. s_player_codeObject = -1;
  237. };
  238.  
  239.  
  240. // Remove Object from code
  241. if((typeOf(cursortarget) in allbuildables_class) && _canDo && removeObject && !procBuild && !remProc) then {
  242. _validObject = cursortarget getVariable ["validObject",false];
  243. if (_validObject) then {
  244. if (s_player_codeRemove < 0) then {
  245. s_player_codeRemove = player addaction [("<t color=""#8E11F5"">" + ("Base Owners Remove Object") +"</t>"),"dayz_code\actions\player_remove.sqf","",5,false,true,"",""];
  246. };
  247. } else {
  248. player removeAction s_player_codeRemove;
  249. s_player_codeRemove = -1;
  250. };
  251. } else {
  252. player removeAction s_player_codeRemove;
  253. s_player_codeRemove = -1;
  254. };
  255. // Disarm Booby Trap Action
  256. if(_hasToolbox && _canDo && !remProc && !procBuild && (cursortarget iskindof "Grave" && cursortarget distance player < 2.5 && !(cursortarget iskindof "Body" || cursortarget iskindof "GraveCross1" || cursortarget iskindof "GraveCross2" || cursortarget iskindof "GraveCrossHelmet" || cursortarget iskindof "Land_Church_tomb_1" || cursortarget iskindof "Land_Church_tomb_2" || cursortarget iskindof "Land_Church_tomb_3" || cursortarget iskindof "Mass_grave"))) then {
  257. if (s_player_disarmBomb < 0) then {
  258. s_player_disarmBomb = player addaction [("<t color=""#F01313"">" + ("Disarm Bomb") +"</t>"),"dayz_code\actions\player_disarmBomb.sqf","",1,true,true,"", ""];
  259. };
  260. } else {
  261. player removeAction s_player_disarmBomb;
  262. s_player_disarmBomb = -1;
  263. };
  264.  
  265. // ------------------------------------------------------------------------kikyou2 Edit Button Start---------------------------------------------------------------------
  266. if((typeOf(cursortarget) in allbuildables_class) && _canDo && !procBuild && !remProc && (_ownerID == dayz_playerUID)) then {
  267. if (true) then {
  268. if (s_player_codeEdit < 0) then {
  269. s_player_codeEdit = player addaction [("<t color=""#00ffff"">" + ("Edit Code") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\editCode.sqf"];
  270. };
  271. } else {
  272. player removeAction s_player_codeEdit;
  273. s_player_codeEdit = -1;
  274. };
  275. } else {
  276. player removeAction s_player_codeEdit;
  277. s_player_codeEdit = -1;
  278. };
  279. // ------------------------------------------------------------------------kikyou2 Edit Button End-----------------------------------------------------------------------
  280.  
  281. //##### BASE BUILDING 1.2 Custom Actions (CROSSHAIR HAS A TARGET) #####
  282. // ##### END #####
  283.  
  284. // Allow Owner to lock and unlock vehicle
  285. if(_isVehicle and !_isMan and _canDo and _ownerID != "0") then {
  286.  
  287. if (s_player_lockUnlock_crtl < 0) then {
  288.  
  289. if(locked cursorTarget) then {
  290. if(_ownerID == dayz_playerUID) then {
  291. _Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",cursorTarget, 2, true, true, "", ""];
  292. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  293. s_player_lockUnlock_crtl = 1;
  294. } else {
  295. _Unlock = player addAction ["<t color='#ff0000'>Vehicle Locked</t>", "",cursorTarget, 2, true, true, "", ""];
  296. s_player_lockunlock set [count s_player_lockunlock,_Unlock];
  297. s_player_lockUnlock_crtl = 1;
  298. };
  299. } else {
  300. if(_ownerID == dayz_playerUID) then {
  301. _lock = player addAction [format["Lock %1",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",cursorTarget, 1, true, true, "", ""];
  302. s_player_lockunlock set [count s_player_lockunlock,_lock];
  303. s_player_lockUnlock_crtl = 1;
  304. };
  305. };
  306.  
  307. };
  308.  
  309. } else {
  310. {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
  311. s_player_lockUnlock_crtl = -1;
  312. };
  313.  
  314.  
  315. if((_isVehicle or _isTent or (cursorTarget isKindOf "VaultStorage")) and _isAlive and _canDo and !_isMan) then {
  316. if (s_player_checkGear < 0) then {
  317. s_player_checkGear = player addAction ["Cargo Check", "\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. //flip vehicle
  325. if ((_isVehicletype) and !_canmove and _isAlive and (player distance cursorTarget >= 2) and (count (crew cursorTarget))== 0 and ((vectorUp cursorTarget) select 2) < 0.5) then {
  326. if (s_player_flipveh < 0) then {
  327. s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",cursorTarget, 1, true, true, "", ""];
  328. };
  329. } else {
  330. player removeAction s_player_flipveh;
  331. s_player_flipveh = -1;
  332. };
  333.  
  334. //Allow player to fill jerrycan
  335. if(_hasFuelE and _isFuel and _canDo) then {
  336. if (s_player_fillfuel < 0) then {
  337. s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
  338. };
  339. } else {
  340. player removeAction s_player_fillfuel;
  341. s_player_fillfuel = -1;
  342. };
  343.  
  344. // Human Gut animal or zombie
  345. if (!alive cursorTarget and (_isAnimal or _isZombie) and _hasKnife and !_isHarvested and _canDo) then {
  346. if (s_player_butcher < 0) then {
  347. if(_isZombie) then {
  348. s_player_butcher = player addAction ["Gut Zombie", "\z\addons\dayz_code\actions\gather_zparts.sqf",cursorTarget, 3, true, true, "", ""];
  349. } else {
  350. s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
  351. };
  352. };
  353. } else {
  354. player removeAction s_player_butcher;
  355. s_player_butcher = -1;
  356. };
  357.  
  358. //Fireplace Actions check
  359. if (inflamed cursorTarget and _hasRawMeat and _canDo) then {
  360. if (s_player_cook < 0) then {
  361. s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",cursorTarget, 3, true, true, "", ""];
  362. };
  363. } else {
  364. player removeAction s_player_cook;
  365. s_player_cook = -1;
  366. };
  367. if (inflamed cursorTarget and (_hasbottleitem and _hastinitem) and _canDo) then {
  368. if (s_player_boil < 0) then {
  369. s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",cursorTarget, 3, true, true, "", ""];
  370. };
  371. } else {
  372. player removeAction s_player_boil;
  373. s_player_boil = -1;
  374. };
  375.  
  376. if(cursorTarget == dayz_hasFire and _canDo) then {
  377. if ((s_player_fireout < 0) and !(inflamed cursorTarget) and (player distance cursorTarget < 3)) then {
  378. s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",cursorTarget, 0, false, true, "",""];
  379. };
  380. } else {
  381. player removeAction s_player_fireout;
  382. s_player_fireout = -1;
  383. };
  384.  
  385. //Packing my tent
  386. if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  387. if ((s_player_packtent < 0) and (player distance cursorTarget < 3)) then {
  388. s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",cursorTarget, 0, false, true, "",""];
  389. };
  390. } else {
  391. player removeAction s_player_packtent;
  392. s_player_packtent = -1;
  393. };
  394.  
  395. //Allow owner to unlock vault
  396. if(cursorTarget isKindOf "VaultStorageLocked" and _canDo and _ownerID != "0" and _ownerID == dayz_playerUID and !UnlockInprogress) then {
  397. if (s_player_unlockvault < 0 and (player distance cursorTarget < 3)) then {
  398. s_player_unlockvault = player addAction ["Unlock Safe", "\z\addons\dayz_code\actions\vault_unlock.sqf",cursorTarget, 0, false, true, "",""];
  399. };
  400. } else {
  401. player removeAction s_player_unlockvault;
  402. s_player_unlockvault = -1;
  403. };
  404.  
  405. //Allow owner to pack vault
  406. if(cursorTarget isKindOf "VaultStorage" and _canDo and _ownerID != "0" and _ownerID == dayz_playerUID and (player distance cursorTarget < 3)) then {
  407.  
  408. if (s_player_lockvault < 0) then {
  409. s_player_lockvault = player addAction ["Lock Safe", "\z\addons\dayz_code\actions\vault_lock.sqf",cursorTarget, 0, false, true, "",""];
  410. };
  411. if (s_player_packvault < 0) then {
  412. s_player_packvault = player addAction ["<t color='#ff0000'>Pack Safe</t>", "\z\addons\dayz_code\actions\vault_pack.sqf",cursorTarget, 0, false, true, "",""];
  413. };
  414. } else {
  415. player removeAction s_player_packvault;
  416. s_player_packvault = -1;
  417. player removeAction s_player_lockvault;
  418. s_player_lockvault = -1;
  419. };
  420.  
  421.  
  422.  
  423. //Player Deaths
  424. if(cursorTarget isKindOf "Info_Board_EP1" and _canDo) then {
  425. if ((s_player_information < 0) and (player distance cursorTarget < 3)) then {
  426. s_player_information = player addAction ["Recent Deaths", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 0, false, true, "",""];
  427. };
  428. } else {
  429. player removeAction s_player_information;
  430. s_player_information = -1;
  431. };
  432.  
  433.  
  434. //Sleep
  435. if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
  436. if ((s_player_sleep < 0) and (player distance cursorTarget < 3)) then {
  437. s_player_sleep = player addAction ["Sleep", "custom\player_sleep.sqf",cursorTarget, 0, false, true, "",""];
  438. };
  439. } else {
  440. player removeAction s_player_sleep;
  441. s_player_sleep = -1;
  442. };
  443.  
  444. //Repairing Vehicles
  445. if ((dayz_myCursorTarget != cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage cursorTarget < 1)) then {
  446.  
  447. if (s_player_repair_crtl < 0) then {
  448.  
  449. _vehicle = cursorTarget;
  450. dayz_myCursorTarget = _vehicle;
  451.  
  452. _menu = dayz_myCursorTarget addAction ["Repair Vehicle", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_vehicle, 0, true, false, "",""];
  453. _menu1 = dayz_myCursorTarget addAction ["Salvage Vehicle", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_vehicle, 0, true, false, "",""];
  454.  
  455. s_player_repairActions set [count s_player_repairActions,_menu];
  456. s_player_repairActions set [count s_player_repairActions,_menu1];
  457.  
  458. s_player_repair_crtl = 1;
  459.  
  460. } else {
  461. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  462. s_player_repair_crtl = -1;
  463. };
  464. };
  465.  
  466.  
  467.  
  468.  
  469.  
  470. _humanity = player getVariable ["humanity",0];
  471.  
  472.  
  473.  
  474. //Pack Vehicles
  475. if (_typeOfCursorTarget in EVDVehicleArray and _hasToolbox and !(locked _cursorTarget) and (damage _cursorTarget < 1)) then {
  476. if (s_player_packvehicle < 0) then {
  477. s_player_packvehicle = player addAction ["Pack Vehicle", "Scripts\EVD\EVD_pack.sqf",_cursorTarget, 0, false, true, "",""];
  478. };
  479. } else {
  480. player removeAction s_player_packvehicle;
  481. s_player_packvehicle = -1;
  482. };
  483.  
  484. // All Traders
  485. if (_isMan and !_isPZombie and _traderType in serverTraders) then {
  486.  
  487. if (s_player_parts_crtl < 0) then {
  488.  
  489. //diag_log ("TRADER = " + str(serverTraders));
  490.  
  491. _traderMenu = call compile format["menu_%1;",_traderType];
  492.  
  493. diag_log ("TRADER = " + str(_traderMenu));
  494.  
  495. _low_high = "low";
  496.  
  497. _humanity_logic = false;
  498. if((_traderMenu select 2) == "friendly") then {
  499. //_low_high = "low";
  500. if (_humanity < -2000) then {
  501. _humanity_logic = true;
  502. };
  503. };
  504. if((_traderMenu select 2) == "hostile") then {
  505. _low_high = "high";
  506. if (_humanity > -2000) then {
  507. _humanity_logic = true;
  508. };
  509. };
  510. if((_traderMenu select 2) == "hero") then {
  511. //_low_high = "low";
  512. if (_humanity < 5000) then {
  513. _humanity_logic = true;
  514. };
  515. };
  516. if(_humanity_logic) then {
  517. _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, "",""];
  518. s_player_parts set [count s_player_parts,_cancel];
  519. } else {
  520.  
  521. // Static Menu
  522. {
  523. diag_log format["DEBUG TRADER: %1", _x];
  524. _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, "",""];
  525. s_player_parts set [count s_player_parts,_buy];
  526.  
  527. } forEach (_traderMenu select 1);
  528. // Database menu
  529. {
  530. _buy = player addAction [(_x select 0), "\z\addons\dayz_code\actions\buy_or_sell.sqf",[(_x select 1),(_x select 0)], 99, true, false, "",""];
  531. s_player_parts set [count s_player_parts,_buy];
  532. } forEach (_traderMenu select 0);
  533.  
  534. // Add static metals trader options under sub menu
  535. _metals_trader = player addAction ["Trade Metals", "\z\addons\dayz_code\actions\trade_metals.sqf",["na"], 0, true, false, "",""];
  536. s_player_parts set [count s_player_parts,_metals_trader];
  537.  
  538. };
  539.  
  540.  
  541.  
  542. s_player_parts_crtl = 1;
  543.  
  544. };
  545. } else {
  546. {player removeAction _x} forEach s_player_parts;s_player_parts = [];
  547. s_player_parts_crtl = -1;
  548. };
  549.  
  550.  
  551.  
  552.  
  553.  
  554. if (_isMan and !_isAlive and !_isZombie) then {
  555. if (s_player_studybody < 0) then {
  556. s_player_studybody = player addAction [localize "str_action_studybody", "study_body.sqf",cursorTarget, 0, false, true, "",""];
  557. };
  558. } else {
  559. player removeAction s_player_studybody;
  560. s_player_studybody = -1;
  561. };
  562. //CLOTHES
  563. if (_isMan and !_isAlive and !_isZombie and !_isAnimal) then {
  564. if (s_clothes < 0) then {
  565. s_clothes = player addAction [("<t color=""#FF0000"">" + ("Take Clothes") + "</t>"), "fixes\clothes.sqf",cursorTarget, 1, false, true, "",""];
  566. };
  567. } else {
  568. player removeAction s_clothes;
  569. s_clothes = -1;
  570. };
  571.  
  572.  
  573. //Dog
  574. if (_isDog and _isAlive and (_hasRawMeat) and _canDo and _ownerID == "0" and player getVariable ["dogID", 0] == 0) then {
  575. if (s_player_tamedog < 0) then {
  576. s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", cursorTarget, 1, false, true, "", ""];
  577. };
  578. } else {
  579. player removeAction s_player_tamedog;
  580. s_player_tamedog = -1;
  581. };
  582.  
  583.  
  584. if (_isDog and _ownerID == dayz_characterID and _isAlive and _canDo) then {
  585. _dogHandle = player getVariable ["dogID", 0];
  586. if (s_player_feeddog < 0 and _hasRawMeat) then {
  587. s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
  588. };
  589. if (s_player_waterdog < 0 and "ItemWaterbottle" in magazines player) then {
  590. s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
  591. };
  592. if (s_player_staydog < 0) then {
  593. _lieDown = _dogHandle getFSMVariable "_actionLieDown";
  594. if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
  595. s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
  596. };
  597. if (s_player_trackdog < 0) then {
  598. s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
  599. };
  600. if (s_player_barkdog < 0) then {
  601. s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", cursorTarget, 3, false, true,"",""];
  602. };
  603. if (s_player_warndog < 0) then {
  604. _warn = _dogHandle getFSMVariable "_watchDog";
  605. if (_warn) then { _text = "Quiet"; _warn = false; } else { _text = "Alert"; _warn = true; };
  606. s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];
  607. };
  608. if (s_player_followdog < 0) then {
  609. s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
  610. };
  611. } else {
  612. player removeAction s_player_feeddog;
  613. s_player_feeddog = -1;
  614. player removeAction s_player_waterdog;
  615. s_player_waterdog = -1;
  616. player removeAction s_player_staydog;
  617. s_player_staydog = -1;
  618. player removeAction s_player_trackdog;
  619. s_player_trackdog = -1;
  620. player removeAction s_player_barkdog;
  621. s_player_barkdog = -1;
  622. player removeAction s_player_warndog;
  623. s_player_warndog = -1;
  624. player removeAction s_player_followdog;
  625. s_player_followdog = -1;
  626. };
  627. } else {
  628. //Engineering
  629. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  630. s_player_repair_crtl = -1;
  631.  
  632. dayz_myCursorTarget = objNull;
  633. // ### BASE BUILDING 1.2 ### For gates:
  634. // ### START ###
  635. {dayz_myCursorTarget removeAction _x} forEach s_player_gateActions;s_player_gateActions = [];
  636. dayz_myCursorTarget = objNull;
  637. // ### BASE BUILDING 1.2 ### For gates:
  638. // ### END ###
  639.  
  640. //{player removeAction _x} forEach s_player_madsci;s_player_madsci = [];
  641. {player removeAction _x} forEach s_player_parts;s_player_parts = [];
  642.  
  643. //{player removeAction _x} forEach s_player_bank;s_player_bank = [];
  644. {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
  645.  
  646. player removeAction s_player_checkGear;
  647. s_player_checkGear = -1;
  648.  
  649. //s_player_madsci_crtl = -1;
  650. s_player_parts_crtl = -1;
  651.  
  652. // lock unlock vehicles
  653. s_player_lockUnlock_crtl = -1;
  654.  
  655. // Bank Vault
  656. s_player_bankvault_crtl = -1;
  657.  
  658. //Others
  659. player removeAction s_player_forceSave;
  660. s_player_forceSave = -1;
  661. player removeAction s_player_flipveh;
  662. s_player_flipveh = -1;
  663. player removeAction s_player_sleep;
  664. s_player_sleep = -1;
  665. player removeAction s_player_deleteBuild;
  666. s_player_deleteBuild = -1;
  667. // ### BASE BUILDING 1.2 ### Add in these:
  668. // ### START ###
  669. player removeAction s_player_codeRemove;
  670. s_player_codeRemove = -1;
  671. player removeAction s_player_forceSave;
  672. s_player_forceSave = -1;
  673. player removeAction s_player_disarmBomb;
  674. s_player_disarmBomb = -1;
  675. player removeAction s_player_codeObject;
  676. s_player_codeObject = -1;
  677. player removeAction s_player_enterCode;
  678. s_player_enterCode = -1;
  679. player removeAction s_player_smeltRecipes;
  680. s_player_smeltRecipes = -1;
  681. player removeAction s_player_smeltItems;
  682. s_player_smeltItems = -1;
  683. // ------------------------------------------------------------------------kikyou2 Edit Button Start---------------------------------------------------------------------
  684. player removeAction s_player_codeEdit;
  685. s_player_codeEdit = -1;
  686. // ------------------------------------------------------------------------kikyou2 Edit Button End-----------------------------------------------------------------------
  687. // ### BASE BUILDING 1.2 ### Add in these:
  688. // ### END ###
  689. player removeAction s_player_butcher;
  690. s_player_butcher = -1;
  691. player removeAction s_player_cook;
  692. s_player_cook = -1;
  693. player removeAction s_player_boil;
  694. s_player_boil = -1;
  695. player removeAction s_player_fireout;
  696. s_player_fireout = -1;
  697. player removeAction s_player_packtent;
  698. s_player_packtent = -1;
  699. player removeAction s_player_fillfuel;
  700. s_player_fillfuel = -1;
  701. player removeAction s_player_studybody;
  702. s_player_studybody = -1;
  703. player removeAction s_clothes;
  704. s_clothes = -1;
  705. //Dog
  706. player removeAction s_player_tamedog;
  707. s_player_tamedog = -1;
  708. player removeAction s_player_feeddog;
  709. s_player_feeddog = -1;
  710. player removeAction s_player_waterdog;
  711. s_player_waterdog = -1;
  712. player removeAction s_player_staydog;
  713. s_player_staydog = -1;
  714. player removeAction s_player_trackdog;
  715. s_player_trackdog = -1;
  716. player removeAction s_player_barkdog;
  717. s_player_barkdog = -1;
  718. player removeAction s_player_warndog;
  719. s_player_warndog = -1;
  720. player removeAction s_player_followdog;
  721. s_player_followdog = -1;
  722.  
  723. // vault
  724. player removeAction s_player_unlockvault;
  725. s_player_unlockvault = -1;
  726. player removeAction s_player_packvault;
  727. s_player_packvault = -1;
  728. player removeAction s_player_lockvault;
  729. s_player_lockvault = -1;
  730. };
  731.  
  732.  
  733.  
  734. //Dog actions on player self
  735. _dogHandle = player getVariable ["dogID", 0];
  736. if (_dogHandle > 0) then {
  737. _dog = _dogHandle getFSMVariable "_dog";
  738. _ownerID = "0";
  739. if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["characterID","0"]; };
  740. if (_canDo and !_inVehicle and alive _dog and _ownerID != dayz_characterID) then {
  741. if (s_player_movedog < 0) then {
  742. s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
  743. };
  744. if (s_player_speeddog < 0) then {
  745. _text = "Walk";
  746. _speed = 0;
  747. if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = "Run"; };
  748. 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, "", ""];
  749. };
  750. if (s_player_calldog < 0) then {
  751. 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, "", ""];
  752. };
  753. };
  754. } else {
  755. player removeAction s_player_movedog;
  756. s_player_movedog = -1;
  757. player removeAction s_player_speeddog;
  758. s_player_speeddog = -1;
  759. player removeAction s_player_calldog;
  760. s_player_calldog = -1;
  761. };
  762.  
  763. // Zombie Bait
  764. if (("ItemBloodbag" in magazines player) && ("FoodbeefRaw" in magazines player)) then {
  765. hasBait = true;
  766. } else {
  767. hasBait = false;
  768. };
  769. if (hasBait) then {
  770. if (zombieBait < 0) then {
  771. zombieBait = player addAction [("<t color=""#c30000"">" + ("Place Zombie Bait") +"</t>"),"scripts\zombiebait\zombiebait.sqf","",5,false,true,"",""];
  772. };
  773. } else {
  774. player removeAction zombieBait;
  775. zombieBait = -1;
  776. };
  777. // Exploding Zombie Bait
  778. if ((hasBait) && ("HandGrenade_West" in magazines player)) then {
  779. if (zombieBomb < 0) then {
  780. zombieBomb = player addAction [("<t color=""#c30000"">" + ("Place Exploding Bait") +"</t>"),"scripts\zombiebait\zombiebomb.sqf","",5,false,true,"",""];
  781. };
  782. } else {
  783. player removeAction zombieBomb;
  784. zombieBomb = -1;
  785. };
Advertisement
Add Comment
Please, Sign In to add comment