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);
- switch (true) do {
- case (_item in ["waterBottle","coffee","redgull"]): {
- if ([false,_item,1] call life_fnc_handleInv) then {
- life_thirst = 100;
- life_drink = life_drink - 0.02;
- if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 1) then {player setFatigue 0;};
- if (_item isEqualTo "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 "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 "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_spikestrip) exitWith {hint localize "STR_ISTR_SpikesDeployment"; closeDialog 0};
- if ([false,_item,1] call life_fnc_handleInv) then {
- [] spawn life_fnc_spikeStrip;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "gpstracker"): {
- [cursorTarget] spawn life_fnc_gpsTracker;
- };
- case (_item isEqualTo "scalpel"): {
- closeDialog 0; titleText["Cet objet sert a prelever les organes, menottez votre victime avant de pouvoir l'utiliser !","PLAIN"];
- };
- case (_item isEqualTo "kidney"): {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- player setVariable["missingOrgan",false,true];
- life_thirst = 100;
- life_hunger = 100;
- player setFatigue .5;
- };
- };
- case (_item isEqualTo "cigarette"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_cigarette;
- };
- };
- case (_item isEqualTo "marijuana"):
- {
- if((player getVariable ["Druged",FALSE])) exitWith {hint "Vous consommez deja de la drogue";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drug") then {life_drug = 0;};
- life_drug = life_drug + 0.05;
- if (life_drug < 0.00) exitWith {};
- [] spawn life_fnc_weed;
- };
- };
- case (_item isEqualTo "cocaine_processed"):
- {
- if((player getVariable ["Druged",FALSE])) exitWith {hint "Vous consommez deja de la drogue";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drug") then {life_drug = 0;};
- life_drug = life_drug + 0.07;
- if (life_drug < 0.00) exitWith {};
- [] spawn life_fnc_cocaine;
- };
- };
- case (_item isEqualTo "Methp"):
- {
- if((player getVariable ["Druged",FALSE])) exitWith {hint "Vous consommez deja de la drogue";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drug") then {life_drug = 0;};
- life_drug = life_drug + 0.09;
- if (life_drug < 0.00) exitWith {};
- [] spawn life_fnc_meth;
- };
- };
- case (_item isEqualTo "opium_3"):
- {
- if((player getVariable ["Druged",FALSE])) exitWith {hint "Vous consommez deja de la drogue";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drug") then {life_drug = 0;};
- life_drug = life_drug + 0.09;
- if (life_drug < 0.00) exitWith {};
- [] spawn life_fnc_opium;
- };
- };
- //Alcool
- case (_item isEqualTo "vin"):
- {
- if((player getVariable ["inDrink",FALSE])) exitWith {hint "Vous etes deja en train de boire";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drink") then {life_drink = 0;};
- life_drink = life_drink + 0.05;
- if (life_drink < 0.06) exitWith {};
- [] spawn life_fnc_vin;
- };
- };
- case (_item isEqualTo "drinkvin"):
- {
- if((player getVariable ["inDrink",FALSE])) exitWith {hint "Vous etes deja en train de boire";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drink") then {life_drink = 0;};
- life_drink = life_drink + 0.05;
- if (life_drink < 0.06) exitWith {};
- [] spawn life_fnc_drinkvin;
- };
- };
- case (_item isEqualTo "drinkvodka"):
- {
- if((player getVariable ["inDrink",FALSE])) exitWith {hint "Vous etes deja en train de boire";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drink") then {life_drink = 0;};
- life_drink = life_drink + 0.09;
- if (life_drink < 0.10) exitWith {};
- [] spawn life_fnc_drinkvodka;
- };
- };
- case (_item isEqualTo "drinkbiere"):
- {
- if((player getVariable ["inDrink",FALSE])) exitWith {hint "Vous etes deja en train de boire";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drink") then {life_drink = 0;};
- life_drink = life_drink + 0.03;
- if (life_drink < 0.06) exitWith {};
- [] spawn life_fnc_drinkbiere;
- };
- };
- case (_item isEqualTo "drinkwhisky"):
- {
- if((player getVariable ["inDrink",FALSE])) exitWith {hint "Vous etes deja en train de boire";};
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- if(isNil "life_drink") then {life_drink = 0;};
- life_drink = life_drink + 0.10;
- if (life_drink < 0.11) exitWith {};
- [] spawn life_fnc_drinkwhisky;
- };
- };
- 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 isEqualTo "morphine"): {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_morphine;
- };
- };
- //Carte de crédit
- case (_item isEqualTo "credit_1"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_1;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_2"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_2;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_3"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_3;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_4"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_4;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_5"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_5;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_6"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_6;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_7"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_7;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_8"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_8;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_9"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_9;
- closeDialog 0;
- };
- };
- case (_item isEqualTo "credit_10"):
- {
- if(([false,_item,1] call life_fnc_handleInv)) then
- {
- [] spawn life_fnc_credit_10;
- closeDialog 0;
- };
- };
- case (_item in ["apple","rabbit","salema","ornate","mackerel","tuna","mullet","catshark","turtle_soup","hen","rooster","sheep","goat","donuts","tbacon","peach"]): {
- 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