Advertisement
RickyMeekle123

Untitled

Apr 27th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_impoundAction.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Impounds the vehicle
  8. */
  9. private["_vehicle","_type","_time","_value","_vehicleData","_upp","_ui","_progress","_pgText","_cP","_filters","_impoundValue","_price","_impoundMultiplier"];
  10. _vehicle = param [0,ObjNull,[ObjNull]];
  11. _filters = ["Car","Air","Ship"];
  12. if (!((KINDOF_ARRAY(_vehicle,_filters)))) exitWith {};
  13. if (player distance cursorObject > 10) exitWith {};
  14. if (_vehicle getVariable "NPC") exitWith {hint localize "STR_NPC_Protected"};
  15.  
  16. _vehicleData = _vehicle getVariable ["vehicle_info_owners",[]];
  17. if (_vehicleData isEqualTo 0) exitWith {deleteVehicle _vehicle}; //Bad vehicle.
  18. _vehicleName = FETCH_CONFIG2(getText,"CfgVehicles",(typeOf _vehicle),"displayName");
  19. _price = M_CONFIG(getNumber,"LifeCfgVehicles",(typeOf _vehicle),"price");
  20. [0,"STR_NOTF_BeingImpounded",true,[((_vehicleData select 0) select 1),_vehicleName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  21. life_action_inUse = true;
  22.  
  23. _upp = localize "STR_NOTF_Impounding";
  24. //Setup our progress bar.
  25. disableSerialization;
  26. 5 cutRsc ["life_progress","PLAIN"];
  27. _ui = uiNamespace getVariable "life_progress";
  28. _progress = _ui displayCtrl 38201;
  29. _pgText = _ui displayCtrl 38202;
  30. _pgText ctrlSetText format["%2 (1%1)...","%",_upp];
  31. _progress progressSetPosition 0.01;
  32. _cP = 0.01;
  33.  
  34. for "_i" from 0 to 1 step 0 do {
  35. sleep 0.09;
  36. _cP = _cP + 0.01;
  37. _progress progressSetPosition _cP;
  38. _pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];
  39. if (_cP >= 1) exitWith {};
  40. if (player distance _vehicle > 10) exitWith {};
  41. if (!alive player) exitWith {};
  42. };
  43.  
  44. 5 cutText ["","PLAIN"];
  45.  
  46. if (player distance _vehicle > 10) exitWith {hint localize "STR_NOTF_ImpoundingCancelled"; life_action_inUse = false;};
  47. if (!alive player) exitWith {life_action_inUse = false;};
  48.  
  49. if (count crew _vehicle isEqualTo 0) then {
  50. if (!(KINDOF_ARRAY(_vehicle,_filters))) exitWith {life_action_inUse = false;};
  51. _type = FETCH_CONFIG2(getText,"CfgVehicles",(typeOf _vehicle),"displayName");
  52.  
  53. life_impound_inuse = true;
  54.  
  55. if (life_HC_isActive) then {
  56. [_vehicle,true,player] remoteExec ["HC_fnc_vehicleStore",HC_Life];
  57. } else {
  58. [_vehicle,true,player] remoteExec ["TON_fnc_vehicleStore",RSERV];
  59. };
  60.  
  61. waitUntil {!life_impound_inuse};
  62. if (playerSide isEqualTo west) then {
  63. _impoundMultiplier = LIFE_SETTINGS(getNumber,"vehicle_cop_impound_multiplier");
  64. _value = _price * _impoundMultiplier;
  65. [0,"STR_NOTF_HasImpounded",true,[profileName,((_vehicleData select 0) select 1),_vehicleName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  66. if (_vehicle in life_vehicles) then {
  67. hint format[localize "STR_NOTF_OwnImpounded",[_value] call life_fnc_numberText,_type];
  68. BANK = BANK - _value;
  69. } else {
  70. hint format[localize "STR_NOTF_Impounded",[_value] call life_fnc_numberText,_type];
  71. BANK = BANK + _value;
  72. };
  73. if (BANK < 0) then {BANK = 0;};
  74. [1] call SOCK_fnc_updatePartial;
  75. };
  76. } else {
  77. hint localize "STR_NOTF_ImpoundingCancelled";
  78. };
  79.  
  80. life_action_inUse = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement