Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
119
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. };
  31. };
  32.  
  33. case (_item isEqualTo "gpstracker"): { // added
  34. [cursorTarget] spawn life_fnc_gpsTracker;
  35. };
  36.  
  37. case (_item isEqualTo "bombe_peinture"): { // added
  38. [cursorTarget] spawn max_immat_fnc_maskPlate;
  39. };
  40.  
  41. case (_item isEqualTo "boltcutter"): {
  42. [cursorObject] spawn life_fnc_boltcutter;
  43. closeDialog 0;
  44. };
  45.  
  46. case (_item isEqualTo "blastingcharge"): {
  47. player reveal fed_bank;
  48. (group player) reveal fed_bank;
  49. [cursorObject] spawn life_fnc_blastingCharge;
  50. closeDialog 0;
  51. };
  52.  
  53. case (_item isEqualTo "cone"):
  54. {
  55. 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 !"};
  56. if(([false,_item,1] call life_fnc_handleInv)) then
  57. {
  58. [] spawn life_fnc_cone;
  59. closeDialog 0;
  60. };
  61. };
  62. case (_item isEqualTo "barrier"):
  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_barrier;
  68. closeDialog 0;
  69. };
  70. };
  71.  
  72. case (_item isEqualTo "chaise"):
  73. {
  74. 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 !"};
  75. if(([false,_item,1] call life_fnc_handleInv)) then
  76. {
  77. [] spawn life_fnc_chaise;
  78. closeDialog 0;
  79. };
  80. };
  81.  
  82. case (_item isEqualTo "largeBarrier"):
  83. {
  84. 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 !"};
  85. if(([false,_item,1] call life_fnc_handleInv)) then
  86. {
  87. [] spawn life_fnc_largeBarrier;
  88. closeDialog 0;
  89. };
  90. };
  91. case (_item isEqualTo "sandbag"):
  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_sandbag;
  97. closeDialog 0;
  98. };
  99. };
  100.  
  101. case (_item isEqualTo "sandbagr"):
  102. {
  103. 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 !"};
  104. if(([false,_item,1] call life_fnc_handleInv)) then
  105. {
  106. [] spawn life_fnc_sandbagr;
  107. closeDialog 0;
  108. };
  109. };
  110.  
  111. case (_item isEqualTo "defusekit"): {
  112. [cursorObject] spawn life_fnc_defuseKit;
  113. closeDialog 0;
  114. };
  115.  
  116. case (_item isEqualTo "storagesmall"): {
  117. [false] call life_fnc_storageBox;
  118. };
  119.  
  120. case (_item isEqualTo "storagebig"): {
  121. [true] call life_fnc_storageBox;
  122. };
  123.  
  124. case (_item isEqualTo "spikeStrip"): {
  125. 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 !"};
  126. if ([false,_item,1] call life_fnc_handleInv) then {
  127. [] spawn life_fnc_spikeStrip;
  128. closeDialog 0;
  129. };
  130. };
  131.  
  132. case (_item isEqualTo "fuelFull"): {
  133. if (vehicle player != player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
  134. [] spawn life_fnc_jerryRefuel;
  135. closeDialog 0;
  136. };
  137.  
  138. case (_item isEqualTo "fuelEmpty"): {
  139. [] spawn life_fnc_jerrycanRefuel;
  140. closeDialog 0;
  141. };
  142.  
  143. case (_item isEqualTo "lockpick"): {
  144. [] spawn life_fnc_lockpick;
  145. closeDialog 0;
  146. };
  147.  
  148. 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"]):
  149. {
  150. if (!(M_CONFIG(getNumber,"VirtualItems",_item,"edible") isEqualTo -1)) then {
  151. if ([false,_item,1] call life_fnc_handleInv) then {
  152. _val = M_CONFIG(getNumber,"VirtualItems",_item,"edible");
  153. _sum = life_hunger + _val;
  154. switch (true) do {
  155. 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
  156. case (_sum > 100): {life_hunger = 100;};
  157. default {life_hunger = _sum;};
  158. };
  159. };
  160. };
  161. };
  162.  
  163. default {
  164. hint localize "STR_ISTR_NotUsable";
  165. };
  166. };
  167.  
  168. [] call life_fnc_p_updateMenu;
  169. [] call life_fnc_hudUpdate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement