Muddr

kh_vehicle_refuel

Feb 3rd, 2013
3,599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. private ["_target", "_caller", "_id"];
  2.  
  3. _target = _this select 0;
  4. _caller = _this select 1;
  5. _id = _this select 2;
  6. _args = _this select 3;
  7. _amount = _args select 0;
  8.  
  9. if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; };
  10.  
  11. if (!ib_refueling_in_progress) then {
  12.  
  13. ib_refueling_in_progress = true;
  14.  
  15. titleText ["Refueling", "PLAIN DOWN", 3];
  16.  
  17. while {(vehicle _caller == _target) and (local _target)} do {
  18. private ["_velocity", "_cfcust"];
  19.  
  20. _velocity = velocity _target;
  21. _cfcust = fuel _target;
  22.  
  23. if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith {
  24. titleText ["Refueling Stopped", "PLAIN DOWN", 3];
  25. };
  26. if (_cfcust >= 1.0) exitWith {
  27. titleText ["Done Refueling", "PLAIN DOWN", 3];
  28. };
  29.  
  30. sleep 0.5;
  31.  
  32. _cfcust = _cfcust + _amount;
  33.  
  34. if (_cfcust >= 1.0) then { _cfcust = 1.0; };
  35.  
  36. _target setFuel _cfcust;
  37. };
  38.  
  39. titleFadeOut 1;
  40.  
  41. ib_refueling_in_progress = false;
  42. };
Advertisement
Add Comment
Please, Sign In to add comment