Advertisement
Guest User

File

a guest
Nov 21st, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  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 || !(_vehicle isKindOf "Car" || _vehicle isKindOf "Air" || _vehicle isKindOf "Ship" || _vehicle isKindOf "Box_IND_Grenades_F" || _vehicle isKindOf "B_supplyCrate_F")) exitWith {}; //Either a null or invalid vehicle type.
  13. if ((_vehicle getVariable ["trunk_in_use",false])) exitWith {hint localize "STR_MISC_VehInvUse"};
  14. _playerNear = (nearestObjects[_vehicle, ["Man"], 12]) arrayIntersect playableUnits;
  15. if(count _playerNear > 1) exitWith {hint "You can't open trunk while a player is near!"};
  16. _vehicle setVariable ["trunk_in_use",true,true];
  17. _vehicle setVariable ["trunk_in_use_by",player,true];
  18. if (!createDialog "TrunkMenu") exitWith {hint localize "STR_MISC_DialogError";}; //Couldn't create the menu?
  19. disableSerialization;
  20.  
  21. if (_vehicle isKindOf "Box_IND_Grenades_F" || _vehicle isKindOf "B_supplyCrate_F") then {
  22. ctrlSetText[3501,format [(localize "STR_MISC_HouseStorage")+ " - %1",getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")]];
  23. } else {
  24. ctrlSetText[3501,format [(localize "STR_MISC_VehStorage")+ " - %1",getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName")]];
  25. };
  26.  
  27. _veh_data = [_vehicle] call life_fnc_vehicleWeight;
  28.  
  29. if (_veh_data select 0 isEqualTo -1) exitWith {closeDialog 0; _vehicle setVariable ["trunk_in_use",false,true]; hint localize "STR_MISC_NoStorageVeh";};
  30.  
  31. ctrlSetText[3504,format [(localize "STR_MISC_Weight")+ " %1/%2",_veh_data select 1,_veh_data select 0]];
  32. [_vehicle] call life_fnc_vehInventory;
  33. life_trunk_vehicle = _vehicle;
  34.  
  35. _vehicle spawn {
  36. waitUntil {isNull (findDisplay 3500)};
  37. _this setVariable ["trunk_in_use",false,true];
  38. if (_this isKindOf "Box_IND_Grenades_F" || _this isKindOf "B_supplyCrate_F") then {
  39.  
  40. if (life_HC_isActive) then {
  41. [_this] remoteExecCall ["HC_fnc_updateHouseTrunk",HC_Life];
  42. } else {
  43. [_this] remoteExecCall ["TON_fnc_updateHouseTrunk",2];
  44. };
  45. };
  46. };
  47.  
  48. if (LIFE_SETTINGS(getNumber,"save_vehicle_virtualItems") isEqualTo 1) then {
  49. _vehicle spawn {
  50. waitUntil {isNull (findDisplay 3500)};
  51. _this setVariable ["trunk_in_use",false,true];
  52. if ((_this isKindOf "Car") || (_this isKindOf "Air") || (_this isKindOf "Ship")) then {
  53. [] call SOCK_fnc_updateRequest;
  54.  
  55. if (life_HC_isActive) then {
  56. [_this,2] remoteExecCall ["HC_fnc_vehicleUpdate",HC_Life];
  57. } else {
  58. [_this,2] remoteExecCall ["TON_fnc_vehicleUpdate",2];
  59. };
  60. };
  61. };
  62. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement