Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. #include "..\..\The-Programmer\Plants\scripts\useItemSelect.sqf"
  14.  
  15. switch (true) do {
  16. #include "..\..\The-Programmer\EffetsEcran\scripts\useItemSelect.sqf"
  17. case (_item in ["waterBottle","coffee","redgull","humelscola","fanta_litchi","coca","fanta","icetea","sprite"]): {
  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 in ["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. if (_item in ["autre_redgull"] && {LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1}) then {
  31. [] spawn {
  32. life_redgull_effect = time;
  33. titleText[localize "STR_ISTR_RedGullEffect","PLAIN"];
  34. player enableFatigue false;
  35. waitUntil {!alive player || ((time - life_redgull_effect) > (9 * 60))};
  36. player enableFatigue true;
  37. };
  38. };
  39. };
  40. };
  41.  
  42. case (_item isEqualTo "gpstracker"): { // added
  43. [cursorTarget] spawn life_fnc_gpsTracker;
  44. };
  45.  
  46. case (_item isEqualTo "bombe_peinture"): { // added
  47. [cursorTarget] spawn max_immat_fnc_maskPlate;
  48. };
  49.  
  50. case (_item isEqualTo "boltcutter"): {
  51. [cursorObject] spawn life_fnc_boltcutter;
  52. closeDialog 0;
  53. };
  54.  
  55. case (_item isEqualTo "blastingcharge"): {
  56. player reveal fed_bank;
  57. (group player) reveal fed_bank;
  58. [cursorObject] spawn life_fnc_blastingCharge;
  59. closeDialog 0;
  60. };
  61.  
  62. case (_item isEqualTo "cone"):
  63. {
  64. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  65. if(([false,_item,1] call life_fnc_handleInv)) then
  66. {
  67. [] spawn life_fnc_cone;
  68. closeDialog 0;
  69. };
  70. };
  71. case (_item isEqualTo "barrier"):
  72. {
  73. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  74. if(([false,_item,1] call life_fnc_handleInv)) then
  75. {
  76. [] spawn life_fnc_barrier;
  77. closeDialog 0;
  78. };
  79. };
  80.  
  81. case (_item isEqualTo "chaise"):
  82. {
  83. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  84. if(([false,_item,1] call life_fnc_handleInv)) then
  85. {
  86. [] spawn life_fnc_chaise;
  87. closeDialog 0;
  88. };
  89. };
  90.  
  91. case (_item isEqualTo "largeBarrier"):
  92. {
  93. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  94. if(([false,_item,1] call life_fnc_handleInv)) then
  95. {
  96. [] spawn life_fnc_largeBarrier;
  97. closeDialog 0;
  98. };
  99. };
  100. case (_item isEqualTo "sandbag"):
  101. {
  102. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  103. if(([false,_item,1] call life_fnc_handleInv)) then
  104. {
  105. [] spawn life_fnc_sandbag;
  106. closeDialog 0;
  107. };
  108. };
  109.  
  110. case (_item isEqualTo "sandbagr"):
  111. {
  112. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  113. if(([false,_item,1] call life_fnc_handleInv)) then
  114. {
  115. [] spawn life_fnc_sandbagr;
  116. closeDialog 0;
  117. };
  118. };
  119.  
  120. case (_item isEqualTo "defusekit"): {
  121. [cursorObject] spawn life_fnc_defuseKit;
  122. closeDialog 0;
  123. };
  124.  
  125. case (_item isEqualTo "storagesmall"): {
  126. [false] call life_fnc_storageBox;
  127. };
  128.  
  129. case (_item isEqualTo "storagebig"): {
  130. [true] call life_fnc_storageBox;
  131. };
  132.  
  133. case (_item isEqualTo "spikeStrip"): {
  134. if(!isNull life_table || !isNull life_chair || !isNull life_djturntable || !isNull life_spikestrip || !isNull life_barrier || !isNull largeBarrier || !isNull life_cone || !isNull life_sandbag || !isNull life_sandbagr) exitWith {hint "Vous avez déjà un objet à poser en main !"};
  135. if ([false,_item,1] call life_fnc_handleInv) then {
  136. [] spawn life_fnc_spikeStrip;
  137. closeDialog 0;
  138. };
  139. };
  140.  
  141. case (_item isEqualTo "fuelFull"): {
  142. if (vehicle player != player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
  143. [] spawn life_fnc_jerryRefuel;
  144. closeDialog 0;
  145. };
  146.  
  147. case (_item isEqualTo "fuelEmpty"): {
  148. [] spawn life_fnc_jerrycanRefuel;
  149. closeDialog 0;
  150. };
  151.  
  152. case (_item isEqualTo "lockpick"): {
  153. [] spawn life_fnc_lockpick;
  154. closeDialog 0;
  155. };
  156.  
  157. case (_item in ["apple","rabbit","salema","ornate","mackerel","tuna","mullet","catshark","turtle_soup","hen","rooster","sheep","goat","donuts","tbacon","peach","banane", "chocobon", "fromage", "gateau", "mandarine", "saucisson", "raisin","cacao","yalla","chat_minou","nem_crevette","kebab_blanche","kebab_samurai","kebab_marocaine","kebab_space","kebab_ketshup","kebab_mayo","kebab_falefels","frite","pizza_saisons","pizza_fromage","pizza_marguerite","pizza_orientale","burger","tacos","bolderis","pain"]):
  158. {
  159. if (!(M_CONFIG(getNumber,"VirtualItems",_item,"edible") isEqualTo -1)) then {
  160. if ([false,_item,1] call life_fnc_handleInv) then {
  161. _val = M_CONFIG(getNumber,"VirtualItems",_item,"edible");
  162. _sum = life_hunger + _val;
  163. switch (true) do {
  164. 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
  165. case (_sum > 100): {life_hunger = 100;};
  166. default {life_hunger = _sum;};
  167. };
  168. };
  169. };
  170. };
  171.  
  172. default {
  173. hint localize "STR_ISTR_NotUsable";
  174. };
  175. };
  176.  
  177. [] call life_fnc_p_updateMenu;
  178. [] call life_fnc_hudUpdate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement