Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. #include "..\..\macro.h"
  2. /*
  3. File: fn_openInventory.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Starts the initialization of vehicle virtual inventory menu.
  8. */
  9. private["_vehicle","_veh_data"];
  10. if(dialog) exitWith {};
  11. _vehicle = [_this,0,Objnull,[Objnull]] call BIS_fnc_param;
  12. if(isNull _vehicle OR !(_vehicle isKindOf "Car" OR _vehicle isKindOf "Air" OR _vehicle isKindOf "Ship" OR _vehicle isKindOf "House_F")) exitWith {}; //Either a null or invalid vehicle type.
  13.  
  14. sleep random 1.5;
  15.  
  16. if((_vehicle getVariable ["trunk_in_use",false])) exitWith {hint localize "STR_MISC_VehInvUse"};
  17. if(life_is_processing) exitWith {hint "Vous êtes en train d'effectuer un traitement ...";};
  18. _vehicle setVariable["trunk_in_use",true,true];
  19. if(!createDialog "TrunkMenu") exitWith {hint localize "STR_MISC_DialogError";}; //Couldn't create the menu?
  20. disableSerialization;
  21.  
  22. if(_vehicle isKindOf "House_F") then {
  23. ctrlSetText[3501,format[(localize "STR_MISC_HouseStorage")+ " - %1",getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")]];
  24. } else {
  25. ctrlSetText[3501,format[(localize "STR_MISC_VehStorage")+ " - %1",getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")]];
  26. };
  27.  
  28. if(_vehicle isKindOf "House_F") then {
  29. private["_mWeight"];
  30. _mWeight = 0;
  31. {_mWeight = _mWeight + ([(typeOf _x)] call life_fnc_vehicleWeightCfg);} foreach (_vehicle getVariable["containers",[]]);
  32. _veh_data = [_mWeight,(_vehicle getVariable["Trunk",[[],0]]) select 1];
  33. } else {
  34. _veh_data = [_vehicle] call life_fnc_vehicleWeight;
  35. };
  36.  
  37. if(_vehicle isKindOf "House_F" && {count (_vehicle getVariable ["containers",[]]) == 0}) exitWith {hint localize "STR_MISC_NoStorageWarn"; closeDialog 0; _vehicle setVariable["trunk_in_use",false,true];};
  38. if(_veh_data select 0 == -1 && {!(_vehicle isKindOf "House_F")}) exitWith {closeDialog 0; _vehicle setVariable["trunk_in_use",false,true]; hint localize "STR_MISC_NoStorageVeh";};
  39.  
  40. ctrlSetText[3504,format[(localize "STR_MISC_Weight")+ " %1/%2",_veh_data select 1,_veh_data select 0]];
  41. [_vehicle] call life_fnc_vehInventory;
  42. life_trunk_vehicle = _vehicle;
  43.  
  44. _vehicle spawn
  45. {
  46. waitUntil {sleep 0.1; isNull (findDisplay 3500)};
  47. _this setVariable["trunk_in_use",false,true];
  48. if(_this isKindOf "House_F") then {
  49. [_this,player] remoteExecCall ["TON_fnc_updateHouseTrunk",RSERV];
  50. };
  51. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement