Advertisement
louloufred

Untitled

Dec 14th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 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","_insurance","_insuranceMultiplier","_price","_storageFee","_purchasePrice","_insurancePrice","_immatriculation","_controltech"];
  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. _insurance = (_dataArr select 2);
  20. _controltech = (_dataArr select 4);
  21. _immatriculation = (_dataArr select 3);
  22.  
  23. if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _classNameLife)) then {
  24. _classNameLife = "Default"; //Use Default class if it doesn't exist
  25. diag_log format ["%1: LifeCfgVehicles class doesn't exist",_className];
  26. };
  27.  
  28. _vehicleColor = ((M_CONFIG(getArray,"LifeCfgVehicles",_classNameLife,"textures") select (_dataArr select 1)) select 0);
  29. if (isNil "_vehicleColor") then {_vehicleColor = "Default";};
  30.  
  31. _vehicleInfo = [_className] call life_fnc_fetchVehInfo;
  32. _trunkSpace = [_className] call life_fnc_vehicleWeightCfg;
  33.  
  34. _price = M_CONFIG(getNumber,"LifeCfgVehicles",_classNameLife,"price");
  35. _storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");
  36.  
  37. switch (playerSide) do {
  38. case civilian: {
  39. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");
  40. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN");
  41. _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_CIVILIAN");
  42. };
  43. case west: {
  44. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");
  45. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP");
  46. _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_COP");
  47. };
  48. case independent: {
  49. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");
  50. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC");
  51. _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_MEDIC");
  52. };
  53. case east: {
  54. _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");
  55. _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR");
  56. _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_OPFOR");
  57. };
  58. };
  59. _retrievePrice = _purchasePrice * _storageFee;
  60. _sellPrice = _purchasePrice * _sellMultiplier;
  61. _insurancePrice = _purchasePrice * _insuranceMultiplier;
  62.  
  63. if (!(_sellPrice isEqualType 0) || _sellPrice < 1) then {_sellPrice = 500;};
  64. if (!(_retrievePrice isEqualType 0) || _retrievePrice < 1) then {_retrievePrice = 500;};
  65. if (!(_insurancePrice isEqualType 0) || _insurancePrice < 1) then {_insurancePrice = 500;};
  66.  
  67. _immatriculation = (_dataArr select 3);
  68. if (_immatriculation == "0") then {_immatriculation = "Aucune"} else {_immatriculation = format ["%1-%2-%3",_immatriculation select [0,2],_immatriculation select [2,3],_immatriculation select [5,2]];};
  69.  
  70. (CONTROL(2800,2803)) ctrlSetStructuredText parseText format[
  71. (localize "STR_Shop_Veh_UI_RetrievalP")+ " <t color='#8cff9b'>$%1</t><br/>
  72. " +(localize "STR_Shop_Veh_UI_SellP")+ " <t color='#8cff9b'>$%2</t><br/>
  73. Prix de l'assurance: <t color='#8cff9b'>$%9</t><br/>
  74. Etat de l'assurance: %10 <br/>
  75. License Plate: <t color='#8cff9b'>%11</t><br/>
  76. Etat du controle technique: %12<br/>
  77. Type d’essence : %13<br/>
  78. " +(localize "STR_Shop_Veh_UI_Color")+ " <t color='#8cff9b'>%8</t><br/>
  79. " +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " <t color='#8cff9b'>%3 km/h</t><br/>
  80. " +(localize "STR_Shop_Veh_UI_HPower")+ " <t color='#8cff9b'>%4</t><br/>
  81. " +(localize "STR_Shop_Veh_UI_PSeats")+ " <t color='#8cff9b'>%5</t><br/>
  82. " +(localize "STR_Shop_Veh_UI_Trunk")+ " <t color='#8cff9b'>%6</t><br/>
  83. " +(localize "STR_Shop_Veh_UI_Fuel")+ " <t color='#8cff9b'>%7</t>
  84. ",
  85. [_retrievePrice] call life_fnc_numberText,
  86. [_sellPrice] call life_fnc_numberText,
  87. (_vehicleInfo select 8),
  88. (_vehicleInfo select 11),
  89. (_vehicleInfo select 10),
  90. if (_trunkSpace isEqualTo -1) then {"None"} else {_trunkSpace},
  91. (_vehicleInfo select 12),
  92. _vehicleColor,
  93. [_insurancePrice] call life_fnc_numberText,
  94. if(_insurance == 1) then {"<t color='#8cff9b'>Assuré</t>"} else {"<t color='#FF0000'>Pas d'assurance</t>"},
  95. _immatriculation,
  96. if ((_dataArr select 4) < (getNumber(missionConfigFile >> "Max_Settings_ControlTech" >> "nb_sorties_perte_controltech"))) then {"<t color='#8cff9b'>Valide</t>"} else {"<t color='#FF0000'>Invalide</t>"},
  97. [_classNameLife] call max_fuelstations_fnc_getFuelType,
  98. (_vehicleInfo select 9)
  99. ];
  100. if(_insurance == 1) then {
  101. ctrlShow [97480,False];
  102. }else{
  103. ctrlShow [97480,True];
  104. };
  105.  
  106. ctrlShow [2803,true];
  107. ctrlShow [2830,true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement