Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "..\..\script_macros.hpp"
- /*
- File: fn_useItem.sqf
- Author: Bryan "Tonic" Boardwine
- Description:
- Main function for item effects and functionality through the player menu.
- */
- private "_item";
- disableSerialization;
- if ((lbCurSel 2005) isEqualTo -1) exitWith {hint localize "STR_ISTR_SelectItemFirst";};
- _item = CONTROL_DATA(2005);
- #include "..\..\The-Programmer\Plants\scripts\useItemSelect.sqf"
- switch (true) do {
- #include "..\..\The-Programmer\EffetsEcran\scripts\useItemSelect.sqf"
- case (_item in ["waterBottle","coffee","redgull","humelscola","fanta_litchi","coca","fanta","icetea","sprite"]): {
- if ([false,_item,1] call life_fnc_handleInv) then {
- life_thirst = 100;
- if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 0;};
- if (_item in ["redgull"] && {LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1}) then {
- [] spawn {
- life_redgull_effect = time;
- titleText[localize "STR_ISTR_RedGullEffect","PLAIN"];
- player enableFatigue false;
- waitUntil {!alive player || ((time - life_redgull_effect) > (3 * 60))};
- player enableFatigue true;
- };
- };
- };
- };
- case (_item isEqualTo "gpstracker"): { // added
- [cursorTarget] spawn life_fnc_gpsTracker;
- };
- case (_item isEqualTo "bombe_peinture"): { // added
- [cursorTarget] spawn max_immat_fnc_maskPlate;
- };
- case (_item isEqualTo "boltcutter"): {
- [cursorObject] spawn life_fnc_boltcutter;
- closeDialog 0;
- };
- case (_item isEqualTo "blastingcharge"): {
- player reveal fed_bank;
- (group player) reveal fed_bank;
- [cursorObject] spawn life_fnc_blastingCharge;
- closeDialog 0;
- };
- case (_item isEqualTo "cone"):
- {
- 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 !"};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_cone;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "barrier"):
- {
- 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 !"};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_barrier;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "chaise"):
- {
- 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 !"};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_chaise;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "largeBarrier"):
- {
- 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 !"};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_largeBarrier;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "sandbag"):
- {
- 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 !"};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_sandbag;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "sandbagr"):
- {
- 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 !"};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_sandbagr;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "defusekit"): {
- [cursorObject] spawn life_fnc_defuseKit;
- closeDialog 0;
- };
- case (_item isEqualTo "storagesmall"): {
- [false] call life_fnc_storageBox;
- };
- case (_item isEqualTo "storagebig"): {
- [true] call life_fnc_storageBox;
- };
- case (_item isEqualTo "spikeStrip"): {
- 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 !"};
- if ([false,_item,1] call life_fnc_handleInv) then {
- [] spawn life_fnc_spikeStrip;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "fuelFull"): {
- if (vehicle player != player) exitWith {hint localize "STR_ISTR_RefuelInVehicle"};
- [] spawn life_fnc_jerryRefuel;
- closeDialog 0;
- };
- case (_item isEqualTo "fuelEmpty"): {
- [] spawn life_fnc_jerrycanRefuel;
- closeDialog 0;
- };
- case (_item isEqualTo "lockpick"): {
- [] spawn life_fnc_lockpick;
- closeDialog 0;
- };
- 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"]):
- {
- if (!(M_CONFIG(getNumber,"VirtualItems",_item,"edible") isEqualTo -1)) then {
- if ([false,_item,1] call life_fnc_handleInv) then {
- _val = M_CONFIG(getNumber,"VirtualItems",_item,"edible");
- _sum = life_hunger + _val;
- switch (true) do {
- 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
- case (_sum > 100): {life_hunger = 100;};
- default {life_hunger = _sum;};
- };
- };
- };
- };
- default {
- hint localize "STR_ISTR_NotUsable";
- };
- };
- [] call life_fnc_p_updateMenu;
- [] call life_fnc_hudUpdate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement