Advertisement
Guest User

fn_garageLBChange.sqf

a guest
Aug 8th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_garageLBChange.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Can't be bothered to answer it.. Already deleted it by accident..
  8. */
  9. disableSerialization;
  10. private ["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_price","_storageFee","_purchasePrice","_numberPlate"];
  11. _control = _this select 0;
  12. _index = _this select 1;
  13.  
  14. //Fetch some information.
  15. _dataArr = CONTROL_DATAI(_control,_index);
  16. _dataArr = call compile format ["%1",_dataArr];
  17. _className = (_dataArr select 0);
  18. _classNameLife = _className;
  19. _numberPlate = (_dataArr select 2);
  20.  
  21. if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
  22. _classNameLife = "Default"; //Use Default class if it doesn't exist
  23. diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
  24. };
  25.  
  26. _vehicleColor = ((M_CONFIG(getArray,"LifeCfgVehicles",_classNameLife,"textures") select (_dataArr select 1)) select 0);
  27. if (isNil "_vehicleColor") then {_vehicleColor = "Default";};
  28.  
  29. _vehicleInfo = [_className] call life_fnc_fetchVehInfo;
  30. _trunkSpace = [_className] call life_fnc_vehicleWeightCfg;
  31.  
  32. _price = M_CONFIG(getNumber,"LifeCfgVehicles",_classNameLife,"price");
  33. _storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");
  34.  
  35. switch (playerSide) do {
  36. case civilian: {
  37. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
  38. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
  39. };
  40. case west: {
  41. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
  42. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
  43. };
  44. case independent: {
  45. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
  46. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
  47. };
  48. case east: {
  49. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
  50. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
  51. };
  52. };
  53. _retrievePrice = _purchasePrice * _storageFee;
  54. _sellPrice = _purchasePrice * _sellMultiplier;
  55.  
  56. if (!(_sellPrice isEqualType 0) || _sellPrice < 1) then {_sellPrice = 500;};
  57. if (!(_retrievePrice isEqualType 0) || _retrievePrice < 1) then {_retrievePrice = 500;};
  58.  
  59. (CONTROL(2800,2803)) ctrlSetStructuredText parseText format [
  60. (localize "STR_Shop_Veh_UI_RetrievalP")+ " <t color='#8cff9b'>$%1</t><br/>
  61. " +(localize "STR_Shop_Veh_UI_SellP")+ " <t color='#8cff9b'>$%2</t><br/>
  62. " +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/>
  63. " +("License Plate:")+ " %9<br/>
  64. " +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " %3 km/h<br/>
  65. " +(localize "STR_Shop_Veh_UI_HPower")+ " %4<br/>
  66. " +(localize "STR_Shop_Veh_UI_PSeats")+ " %5<br/>
  67. " +(localize "STR_Shop_Veh_UI_Trunk")+ " %6<br/>
  68. " +(localize "STR_Shop_Veh_UI_Fuel")+ " %7
  69. ",
  70. [_retrievePrice] call life_fnc_numberText,
  71. [_sellPrice] call life_fnc_numberText,
  72. (_vehicleInfo select 8),
  73. (_vehicleInfo select 11),
  74. (_vehicleInfo select 10),
  75. if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
  76. (_vehicleInfo select 12),
  77. _vehicleColor,
  78. _numberPlate
  79. ];
  80.  
  81. ctrlShow [2803,true];
  82. ctrlShow [2830,true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement