Jump to content
  • 0

Need help with auto refuling!


Connorbarnes

Question

Again i instaled Bungle's Server pack and it has done some things to the auto refuling and i need to return it so that auto refuling works with all fuel tanks can somone help me do this?

 

Thanks

 

this looks like the script file

 

kh_actions.sqf

 

this is the file itself

 

private ["_vehicle", "_vehicle_refuel_id"];

//Awesomely Edited by Seven, Then modified by Muddr
_vehicle = objNull;
diag_log "Running ""kh_actions"".";
 
_distance = 10; // Distance from object to display Refuel Message
_amount= 0.01; // Amount of fuel to add per loop. Default was 0.005
 
while {true} do
{
    if (!isNull player) then {
        private ["_currentVehicle", "_isNearFeed", "_countFuel"];
_currentVehicle = vehicle player;
_countFuel = (count ((position _currentVehicle) nearObjects ["MAP_GasMeterExt", _distance]));["Land_Ind_TankSmall_EP1", _distance]));
_isNearFeed = _countFuel > 0;
 
        if (_vehicle != _currentVehicle) then {
            if (!isNull _vehicle) then {
                _vehicle removeAction _vehicle_refuel_id;
                _vehicle = objNull;
            };
 
            if (_currentVehicle != player && _isNearFeed && !(_currentVehicle isKindof "Bicycle")) then {
                _vehicle = _currentVehicle;
 
                _vehicle_refuel_id = _vehicle addAction ["Refuel", "custom\kh_vehicle_refuel.sqf", [_amount], -1, false, true, "", "vehicle _this == _target && local _target"];
            };
        };
   
        if (!_isNearFeed) then {
            _vehicle removeAction _vehicle_refuel_id;
            _vehicle = objNull;
        };
    };
    sleep 2;
}

 

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I will post here a duplicate of what I sent to someone in private messages.

 

If you wish to add more options to your refuel script.

 

Change this in kh_actions.sqf to add more classes.

while {true} do
{
    if (!isNull player) then {
        private ["_currentVehicle", "_isNearFeed", "_countFuel"];
_currentVehicle = vehicle player;
_countFuel = (count ((position _currentVehicle) nearObjects ["MAP_GasMeterExt", _distance]));
_isNearFeed = _countFuel > 0;

i.e

​while {true} do
{
    if (!isNull player) then {
        private ["_currentVehicle", "_isNearFeed", "_countFuel"];
_currentVehicle = vehicle player;
_countFuel = (count ((position _currentVehicle) nearObjects ["Land_Fuel_tank_big", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_A_FuelStation_Feed", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_Ind_TankSmall", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_Ind_TankSmall2", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_Ind_TankSmall2_EP1", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_fuel_tank_stairs", _distance]));
_isNearFeed = _countFuel > 0;

You can also increase/decrease distance and refill amount per second via this section above the previous code in fn_actions.sqf

_distance = 15; // Distance from object to display Refuel Message
_amount= 0.01; // Amount of fuel to add per loop. Default was 0.005

Hope it helps.

Link to comment
Share on other sites

  • 0

 

I will post here a duplicate of what I sent to someone in private messages.

 

If you wish to add more options to your refuel script.

 

Change this in kh_actions.sqf to add more classes.

while {true} do
{
    if (!isNull player) then {
        private ["_currentVehicle", "_isNearFeed", "_countFuel"];
_currentVehicle = vehicle player;
_countFuel = (count ((position _currentVehicle) nearObjects ["MAP_GasMeterExt", _distance]));
_isNearFeed = _countFuel > 0;

i.e

​while {true} do
{
    if (!isNull player) then {
        private ["_currentVehicle", "_isNearFeed", "_countFuel"];
_currentVehicle = vehicle player;
_countFuel = (count ((position _currentVehicle) nearObjects ["Land_Fuel_tank_big", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_A_FuelStation_Feed", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_Ind_TankSmall", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_Ind_TankSmall2", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_Ind_TankSmall2_EP1", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["Land_fuel_tank_stairs", _distance]));
_isNearFeed = _countFuel > 0;

You can also increase/decrease distance and refill amount per second via this section above the previous code in fn_actions.sqf

_distance = 15; // Distance from object to display Refuel Message
_amount= 0.01; // Amount of fuel to add per loop. Default was 0.005

Hope it helps.

 

Thanks alot for the help but i have no clue where to put the new lines culd you merger them both for me so i dont break something?  sorry all im used to is 3 editing and modeling ;)

Link to comment
Share on other sites

  • 0

Also with my packs there are blue barrels on the map.. They seem to have a magical Refeul ability if your in a vehicle and looking at it from not too far away.

 

I have no idea how it got there but it refuels damn fast and is a move-able and loadable object that resets each server restart.

 

I think there are even some in the custom villages...

 

Perk or bug you decide and I can remove it..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...