Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_vehInventory.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Used a refresher for the vehicle inventory / trunk menu items.
  8. */
  9. private["_veh","_tInv","_pInv","_veh_data"];
  10. _veh = param [0,ObjNull,[ObjNull]];
  11. if(isNull _veh OR !alive _veh) exitWith {closeDialog 0;}; //If null / dead exit menu
  12. disableSerialization;
  13.  
  14. _tInv = CONTROL(3500,3502);
  15. _pInv = CONTROL(3500,3503);
  16. lbClear _tInv;
  17. lbClear _pInv;
  18.  
  19. _veh_data = [_veh] call life_fnc_vehicleWeight;
  20.  
  21. if(EQUAL(SEL(_veh_data,0),-1)) exitWith {closeDialog 0};
  22.  
  23. ctrlSetText[3504,format["Weight: %1/%2",_veh_data select 1,_veh_data select 0]];
  24. _data = _veh getVariable ["Trunk",[]];
  25. if(EQUAL(count _data,0)) then {_veh setVariable["Trunk",[[],0],true]; _data = [];} else {_data = _data select 0;};
  26. //Player Inventory Items
  27. {
  28. _val = ITEM_VALUE(configName _x);
  29.  
  30. if(_val > 0) then {
  31. _pInv lbAdd format["[%1] - %2",_val,localize (getText(_x >> "displayName"))];
  32. _pInv lbSetData [(lbSize _pInv)-1,configName _x];
  33. _icon = (getText(_x >> "icon"));
  34. if(!(EQUAL(_icon,""))) then {
  35. _pInv lbSetPicture [(lbSize _pInv)-1,_icon];
  36. };
  37. };
  38. } foreach ("true" configClasses (missionConfigFile >> "VirtualItems"));
  39.  
  40. //Trunk Inventory Items
  41. {
  42. _name = M_CONFIG(getText,"VirtualItems",SEL(_x,0),"displayName");
  43. _val = SEL(_x,1);
  44.  
  45. if(_val > 0) then {
  46. _tInv lbAdd format["[%1] - %2",_val,localize _name];
  47. _tInv lbSetData [(lbSize _tInv)-1,SEL(_x,0)];
  48. _icon = M_CONFIG(getText,"VirtualItems",SEL(_x,0),"icon");
  49. if(!(EQUAL(_icon,""))) then {
  50. _tInv lbSetPicture [(lbSize _tInv)-1,_icon];
  51. };
  52. };
  53. } foreach _data;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement