Advertisement
Guest User

repairtruck

a guest
Nov 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_repairTruck.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Main functionality for toolkits, to be revised in later version.
  8. */
  9. private ["_veh","_upp","_ui","_progress","_pgText","_cP","_displayName","_test","_sideRepairArray"];
  10. _veh = cursorObject;
  11. life_interrupted = false;
  12. if (isNull _veh) exitWith {};
  13. if ((_veh isKindOf "Car") || (_veh isKindOf "Ship") || (_veh isKindOf "Air")) then {
  14. if ("ToolKit" in (items player)) then {
  15. life_action_inUse = true;
  16. _displayName = FETCH_CONFIG2(getText,"CfgVehicles",(typeOf _veh),"displayName");
  17. _upp = format [localize "STR_NOTF_Repairing",_displayName];
  18.  
  19. //Setup our progress bar.
  20. disableSerialization;
  21. "progressBar" cutRsc ["life_progress","PLAIN"];
  22. _ui = uiNamespace getVariable "life_progress";
  23. _progress = _ui displayCtrl 38201;
  24. _pgText = _ui displayCtrl 38202;
  25. _pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
  26. _progress progressSetPosition 0.01;
  27. _cP = 0.01;
  28.  
  29. for "_i" from 0 to 1 step 0 do {
  30. if (animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then {
  31. [player,"AinvPknlMstpSnonWnonDnon_medic_1",true] remoteExecCall ["life_fnc_animSync",RCLIENT];
  32. player switchMove "AinvPknlMstpSnonWnonDnon_medic_1";
  33. player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
  34. };
  35.  
  36. uiSleep 0.27;
  37. _cP = _cP + 0.01;
  38. _progress progressSetPosition _cP;
  39. _pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
  40. if (_cP >= 1) exitWith {};
  41. if (!alive player) exitWith {};
  42. if !(isNull objectParent player) exitWith {};
  43. if (life_interrupted) exitWith {};
  44. };
  45.  
  46. life_action_inUse = false;
  47. "progressBar" cutText ["","PLAIN"];
  48. player playActionNow "stop";
  49. if (life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};
  50. if !(isNull objectParent player) exitWith {titleText[localize "STR_NOTF_ActionInVehicle","PLAIN"];};
  51.  
  52. _sideRepairArray = LIFE_SETTINGS(getArray,"vehicle_infiniteRepair");
  53.  
  54. //Check if playerSide has infinite repair enabled
  55. if (playerSide isEqualTo civilian && (_sideRepairArray select 0) isEqualTo 0) then {
  56. [false,"toolkit",1] call life_fnc_handleInv;
  57. };
  58. if (playerSide isEqualTo west && (_sideRepairArray select 1) isEqualTo 0) then {
  59. [false,"toolkit",1] call life_fnc_handleInv;
  60. };
  61. if (playerSide isEqualTo independent && (_sideRepairArray select 2) isEqualTo 0) then {
  62. [false,"toolkit",1] call life_fnc_handleInv;
  63. };
  64. if (playerSide isEqualTo east && (_sideRepairArray select 3) isEqualTo 0) then {
  65. [false,"toolkit",1] call life_fnc_handleInv;
  66. };
  67.  
  68. _veh setDamage 0;
  69. titleText[localize "STR_NOTF_RepairedVehicle","PLAIN"];
  70. };
  71. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement