Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_unimpound.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Yeah... Gets the vehicle from the garage.
  8. */
  9. private ["_vehicle","_vehicleLife","_vid","_pid","_unit","_price","_price","_storageFee","_purchasePrice"];
  10. disableSerialization;
  11. if ((lbCurSel 2802) isEqualTo -1) exitWith {hint localize "STR_Global_NoSelection"};
  12. _vehicle = lbData[2802,(lbCurSel 2802)];
  13. _vehicle = (call compile format ["%1",_vehicle]) select 0;
  14. _vehicleLife = _vehicle;
  15. _vid = lbValue[2802,(lbCurSel 2802)];
  16. _pid = getPlayerUID player;
  17. _unit = player;
  18. _spawntext = localize "STR_Garage_spawn_Success";
  19. if (isNil "_vehicle") exitWith {hint localize "STR_Garage_Selection_Error"};
  20. if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _vehicleLife)) then {
  21. _vehicleLife = "Default"; //Use Default class if it doesn't exist
  22. diag_log format ["%1: LifeCfgVehicles class doesn't exist",_vehicle];
  23. };
  24.  
  25. _price = M_CONFIG(getNumber,"LifeCfgVehicles",_vehicleLife,"price");
  26. _storageFee = LIFE_SETTINGS(getNumber,"vehicle_storage_fee_multiplier");
  27.  
  28. switch (playerSide) do {
  29. case civilian: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN");};
  30. case west: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP");};
  31. case independent: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC");};
  32. case east: {_purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR");};
  33. };
  34. _price = _purchasePrice * _storageFee;
  35.  
  36. if (!(_price isEqualType 0) || _price < 1) then {_price = 500;};
  37. if (BANK < _price) exitWith {hint format [(localize "STR_Garage_CashError"),[_price] call life_fnc_numberText];};
  38.  
  39. if (life_garage_sp isEqualType []) then {
  40. if (life_HC_isActive) then {
  41. [_vid,_pid,(life_garage_sp select 0),_unit,_price,(life_garage_sp select 1),_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
  42. } else {
  43. [_vid,_pid,(life_garage_sp select 0),_unit,_price,(life_garage_sp select 1),_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
  44. };
  45. } else {
  46. if (life_garage_sp in ["medic_spawn_1","medic_spawn_2","medic_spawn_3"]) then {
  47. if (life_HC_isActive) then {
  48. [_vid,_pid,life_garage_sp,_unit,_price,0,_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
  49. } else {
  50. [_vid,_pid,life_garage_sp,_unit,_price,0,_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
  51. };
  52. } else {
  53. if (life_HC_isActive) then {
  54. [_vid,_pid,(getMarkerPos life_garage_sp),_unit,_price,markerDir life_garage_sp,_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
  55. } else {
  56. [_vid,_pid,(getMarkerPos life_garage_sp),_unit,_price,markerDir life_garage_sp,_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
  57. };
  58. };
  59. };
  60. _infos = format ["Vehicule: %1, Prix: %2", _vehicle, _price];
  61. [getPlayerUID player, name player, "Sortie_Garage", _infos] remoteExec ["TON_fnc_logSystem",RSERV];
  62.  
  63. /*_insure = if (((_vehicle getVariable ["dbInfo",[]]) select 2) isEqualTo 1) then {"Véhicule assuré"} else {"Véhicule non assuré"};
  64. _infos = format ["Vehicule: %1, Prix: %2 Assurance: %3", _vehicle, _price,_insure];
  65. [getPlayerUID player, name player, "Sortie_Garage", _infos] remoteExec ["TON_fnc_logSystem",RSERV];*/
  66.  
  67. hint localize "STR_Garage_SpawningVeh";
  68. BANK = BANK - _price;
  69. [1] call SOCK_fnc_updatePartial;
  70. closeDialog 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement