Advertisement
RickyMeekle123

Untitled

May 3rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_useItem.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Main function for item effects and functionality through the player menu.
  8. */
  9. private "_item";
  10. disableSerialization;
  11. if ((lbCurSel 2005) isEqualTo -1) exitWith {hint localize "STR_ISTR_SelectItemFirst";};
  12. _item = CONTROL_DATA(2005);
  13.  
  14. #include "..\..\The-Programmer\Plants\scripts\useItemSelect.sqf"
  15.  
  16. switch (true) do {
  17. case (_item in ["waterBottle","coffee","redgull"]): {
  18. if ([false,_item,1] call life_fnc_handleInv) then {
  19. life_thirst = 100;
  20. if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 0;};
  21. if (_item isEqualTo "redgull" && {LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1}) then {
  22. [] spawn {
  23. life_redgull_effect = time;
  24. titleText[localize "STR_ISTR_RedGullEffect","PLAIN"];
  25. player enableFatigue false;
  26. waitUntil {!alive player || ((time - life_redgull_effect) > (3 * 60))};
  27. player enableFatigue true;
  28. };
  29. };
  30. };
  31. };
  32.  
  33. case (_item isEqualTo "boltcutter"): {
  34. [cursorObject] spawn life_fnc_boltcutter;
  35. closeDialog 0;
  36. };
  37.  
  38. case (_item isEqualTo "blastingcharge"): {
  39. player reveal fed_bank;
  40. (group player) reveal fed_bank;
  41. [cursorObject] spawn life_fnc_blastingCharge;
  42. closeDialog 0;
  43. };
  44.  
  45. case (_item isEqualTo "defusekit"): {
  46. [cursorObject] spawn life_fnc_defuseKit;
  47. closeDialog 0;
  48. };
  49.  
  50. case (_item isEqualTo "storagesmall"): {
  51. [false] call life_fnc_storageBox;
  52. };
  53.  
  54. case (_item isEqualTo "storagebig"): {
  55. [true] call life_fnc_storageBox;
  56. };
  57.  
  58. case (_item isEqualTo "spikeStrip"): {
  59. if (!isNull life_spikestrip) exitWith {hint localize "STR_ISTR_SpikesDeployment"; closeDialog 0};
  60. if ([false,_item,1] call life_fnc_handleInv) then {
  61. [] spawn life_fnc_spikeStrip;
  62. closeDialog 0;
  63. };
  64. };
  65.  
  66. case (_item isEqualTo "fuelFull"): {
  67. if (vehicle player != player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
  68. [] spawn life_fnc_jerryRefuel;
  69. closeDialog 0;
  70. };
  71.  
  72. case (_item isEqualTo "fuelEmpty"): {
  73. [] spawn life_fnc_jerrycanRefuel;
  74. closeDialog 0;
  75. };
  76.  
  77. case (_item isEqualTo "lockpick"): {
  78. [] spawn life_fnc_lockpick;
  79. closeDialog 0;
  80. };
  81.  
  82. case (_item in ["apple","rabbit","salema","ornate","mackerel","tuna","mullet","catshark","turtle_soup","hen","rooster","sheep","goat","donuts","tbacon","peach"]): {
  83. if (!(M_CONFIG(getNumber,"VirtualItems",_item,"edible") isEqualTo -1)) then {
  84. if ([false,_item,1] call life_fnc_handleInv) then {
  85. _val = M_CONFIG(getNumber,"VirtualItems",_item,"edible");
  86. _sum = life_hunger + _val;
  87. switch (true) do {
  88. case (_val < 0 && _sum < 1): {life_hunger = 5;}; //This adds the ability to set the entry edible to a negative value and decrease the hunger without death
  89. case (_sum > 100): {life_hunger = 100;};
  90. default {life_hunger = _sum;};
  91. };
  92. };
  93. };
  94. };
  95.  
  96. default {
  97. hint localize "STR_ISTR_NotUsable";
  98. };
  99. };
  100.  
  101. [] call life_fnc_p_updateMenu;
  102. [] call life_fnc_hudUpdate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement