Advertisement
Guest User

Untitled

a guest
Mar 4th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 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 (BANK < _price) exitWith {hint format [(localize "STR_Garage_CashError"),[_price] call life_fnc_numberText];};
  37.  
  38. if (life_garage_sp isEqualType []) then {
  39. if (life_HC_isActive) then {
  40. [_vid,_pid,(life_garage_sp select 0),_unit,_price,(life_garage_sp select 1),_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
  41. } else {
  42. [_vid,_pid,(life_garage_sp select 0),_unit,_price,(life_garage_sp select 1),_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
  43. };
  44. } else {
  45. if (life_garage_sp in ["medic_spawn_1","medic_spawn_2","medic_spawn_3"]) then {
  46. if (life_HC_isActive) then {
  47. [_vid,_pid,life_garage_sp,_unit,_price,0,_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
  48. } else {
  49. [_vid,_pid,life_garage_sp,_unit,_price,0,_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
  50. };
  51. } else {
  52. if (life_HC_isActive) then {
  53. [_vid,_pid,(getMarkerPos life_garage_sp),_unit,_price,markerDir life_garage_sp,_spawntext] remoteExec ["HC_fnc_spawnVehicle",HC_Life];
  54. } else {
  55. [_vid,_pid,(getMarkerPos life_garage_sp),_unit,_price,markerDir life_garage_sp,_spawntext] remoteExec ["TON_fnc_spawnVehicle",RSERV];
  56. };
  57. };
  58. };
  59.  
  60. hint localize "STR_Garage_SpawningVeh";
  61. BANK = BANK - _price;
  62. [1] call SOCK_fnc_updatePartial;
  63. closeDialog 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement