Advertisement
Guest User

repairactions.sqf

a guest
Jun 6th, 2013
1,369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. private ["_vehicle", "_vehicle_refuel_id"];
  2. //Repair station script by Gorsy
  3.  
  4. //Big thanks to Seven, and Muddr for the original refueling script,
  5. //and big thanks to Zombz.net, Player 2 and Ghost
  6. _vehicle = objNull;
  7. diag_log "Running ""Zombz.net - Repair Stations"".";
  8.  
  9. _distance = 50; // Distance from object to display Refuel Message
  10. _amount= 0.02; // Refuel rate, Repair Rate
  11. _amount2= 0.01; // Repair Rate
  12. while {true} do
  13. {
  14. if (!isNull player) then {
  15. private ["_currentVehicle", "_isNearFeed", "_countFuel"];
  16. _currentVehicle = vehicle player;
  17. _countFuel = (count ((position _currentVehicle) nearObjects ["land_nav_pier_c_big", _distance]));
  18. _countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["land_nav_pier_c_big", _distance]));
  19. _countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["land_nav_pier_c_big", _distance]));
  20. _countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["land_nav_pier_c_big", _distance]));
  21. _countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["land_nav_pier_c_big", _distance]));
  22. _countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["land_nav_pier_c_big", _distance]));
  23. _isNearFeed = _countFuel > 0;
  24.  
  25. if (_vehicle != _currentVehicle) then {
  26. if (!isNull _vehicle) then {
  27. _vehicle removeAction _vehicle_refuel_id;
  28. _vehicle = objNull;
  29. };
  30.  
  31. if (_currentVehicle != player && _isNearFeed && !(_currentVehicle isKindof "Bicycle")) then { //change "Bicycle" to "Land" to allow only air vehicles to aut-refuel
  32. _vehicle = _currentVehicle;
  33.  
  34. _vehicle_refuel_id = _vehicle addAction ["Refuel and Repair", "Scripts\repair.sqf", [_amount,_amount2], -1, false, true, "", "vehicle _this == _target && local _target"];
  35. };
  36. };
  37.  
  38. if (!_isNearFeed) then {
  39. _vehicle removeAction _vehicle_refuel_id;
  40. _vehicle = objNull;
  41. };
  42. };
  43. sleep 2;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement