Advertisement
Guest User

kh_vehicle_repair.sqf by Vampire

a guest
Nov 11th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. // kh_vehicle_repair.sqf
  2. private ["_target", "_caller", "_id"];
  3.  
  4. _target = _this select 0;
  5. _caller = _this select 1;
  6. _id = _this select 2;
  7. _args = _this select 3;
  8. _amount = _args select 0;
  9.  
  10. if (isNil "ib_repairing_in_progress") then { ib_repairing_in_progress = false; };
  11.  
  12. if (!ib_repairing_in_progress) then {
  13.  
  14. ib_repairing_in_progress = true;
  15.  
  16. titleText ["Repairing", "PLAIN DOWN", 3];
  17.  
  18. while {(vehicle _caller == _target) and (local _target)} do {
  19. private ["_velocity", "_damage"];
  20.  
  21. _velocity = velocity _target;
  22. _damage = getDammage _target;
  23.  
  24. if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith {
  25. titleText ["Repairing Stopped", "PLAIN DOWN", 3];
  26. };
  27. if (_damage == 0) exitWith {
  28. titleText ["Done Repairing", "PLAIN DOWN", 3];
  29. };
  30.  
  31. if ((_damage > 0) && (_damage != 0) && (isNearRepair >= 1)) then {
  32. _damage = (_damage - _amount);
  33. if (_damage < 0) then {
  34. _damage = 0;
  35. };
  36. };
  37.  
  38. _target setdammage _damage;
  39. };
  40.  
  41. titleFadeOut 1;
  42.  
  43. ib_repairing_in_progress = false;
  44. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement