Advertisement
Sn0wballs

Untitled

Mar 6th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. #include <macro.h>
  2. /*
  3. File: fn_impoundAction.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Impounds the vehicle
  8. */
  9. private["_vehicle","_type","_time","_price","_vehicleData","_upp","_ui","_progress","_pgText","_cP","_filters"];
  10. _vehicle = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
  11. _filters = ["Car","Air","Ship"];
  12. if(!((KINDOF_ARRAY(_vehicle,_filters)))) exitWith {};
  13. if(player distance cursorTarget > 10) exitWith {};
  14.  
  15. _vehicleData = _vehicle GVAR ["vehicle_info_owners",[]];
  16. if(count _vehicleData == 0) exitWith {deleteVehicle _vehicle}; //Bad vehicle.
  17. _vehicleName = FETCH_CONFIG2(getText,CONFIG_VEHICLES,(typeOf _vehicle),"displayName");
  18. [[0,"STR_NOTF_BeingImpounded",true,[SEL(SEL(_vehicleData,0),1),_vehicleName]],"life_fnc_broadcast",true,false] call life_fnc_MP;
  19. life_action_inUse = true;
  20.  
  21. _upp = localize "STR_NOTF_Impounding";
  22. //Setup our progress bar.
  23. disableSerialization;
  24. 5 cutRsc ["life_progress","PLAIN"];
  25. _ui = GVAR_UINS "life_progress";
  26. _progress = _ui displayCtrl 38201;
  27. _pgText = _ui displayCtrl 38202;
  28. _pgText ctrlSetText format["%2 (1%1)...","%",_upp];
  29. _progress progressSetPosition 0.01;
  30. _cP = 0.01;
  31.  
  32. while{true} do {
  33. sleep 0.09;
  34. _cP = _cP + 0.01;
  35. _progress progressSetPosition _cP;
  36. _pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
  37. if(_cP >= 1) exitWith {};
  38. if(player distance _vehicle > 10) exitWith {};
  39. if(!alive player) exitWith {};
  40. };
  41.  
  42. 5 cutText ["","PLAIN"];
  43.  
  44. if(player distance _vehicle > 10) exitWith {hint localize "STR_NOTF_ImpoundingCancelled"; life_action_inUse = false;};
  45. if(!alive player) exitWith {life_action_inUse = false;};
  46. _crew = crew _vehicle;
  47. {
  48. if(!alive _x) then storeVehicle _x;
  49. } forEach _crew;
  50.  
  51. if(EQUAL(count crew _vehicle,0)) then {
  52. if(!(KINDOF_ARRAY(_vehicle,_filters))) exitWith {life_action_inUse = false;};
  53. _type = FETCH_CONFIG2(getText,CONFIG_VEHICLES,(typeOf _vehicle),"displayName");
  54. switch (true) do {
  55. case (_vehicle isKindOf "Car"): {_price = LIFE_SETTINGS(getNumber,"impound_car");};
  56. case (_vehicle isKindOf "Ship"): {_price = LIFE_SETTINGS(getNumber,"impound_boat");};
  57. case (_vehicle isKindOf "Air"): {_price = LIFE_SETTINGS(getNumber,"impound_air");};
  58. };
  59.  
  60. life_impound_inuse = true;
  61. [[_vehicle,true,player],"TON_fnc_vehicleStore",false,false] call life_fnc_MP;
  62. waitUntil {!life_impound_inuse};
  63. hint format[localize "STR_NOTF_Impounded",_type,_price];
  64. [[0,"STR_NOTF_HasImpounded",true,[profileName,SEL(SEL(_vehicleData,0),1),_vehicleName]],"life_fnc_broadcast",true,false] call life_fnc_MP;
  65. ADD(BANK,_price);
  66. } else {
  67. hint localize "STR_NOTF_ImpoundingCancelled";
  68. };
  69.  
  70. life_action_inUse = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement