DayZ Chenarus Auto Refuel! All stations!

I had no good fn_selfaction ........ I just change it.

refuel the car works well.
I just put gas with full cans, but not reload .........
Right-click the cans to refuel is not present ......
 
i ended up doing something similar to this, just hadnt gotten around to posting it, thanks though cuz this is was i was originally looking for and im sure others would like this also


why is everyone making this so hard for them selves having to add extra objects to their mission file. I use a script that brings a refuel scroll wheel option up when you are near a pump, all it requires is a single line added to the init.sqf. I could easily modify it to be automatic.

add this code after "if (!isDedicated) then {" in your missions init.sqf
PHP:
[] execVM "Scripts\kh_actions.sqf";

Then make a folder called "Scripts" and add these two files

kh_actions.sqf
PHP:
private ["_vehicle", "_vehicle_refuel_id"];
//Awesomely Edited by Seven
_vehicle = objNull;
diag_log "Running ""kh_actions"".";
while {true} do
{
    if (!isNull player) then
    {
        private ["_currentVehicle", "_isNearFeed"];
 
 
        _currentVehicle = vehicle player;
        _isNearFeed = count ((position _currentVehicle) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0;
 
        if (_vehicle != _currentVehicle) then
        {
            if (!isNull _vehicle) then
            {
                _vehicle removeAction _vehicle_refuel_id;
                _vehicle = objNull;
            };
 
            if (_currentVehicle != player && _isNearFeed) then
            {
                _vehicle = _currentVehicle;
 
                _vehicle_refuel_id = _vehicle addAction ["Refuel", "Scripts\kh_vehicle_refuel.sqf", [], -1, false, false, "",
                  "vehicle _this == _target && local _target"];
            };
        };
 
        if (!_isNearFeed) then
        {
            _vehicle removeAction _vehicle_refuel_id;
            _vehicle = objNull;
        };
    };
    sleep 2;
}

kh_vehicle_refuel.sqf
PHP:
private ["_target", "_caller", "_id", "_isNearFeed"];
 
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
 
if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; };
 
if (!ib_refueling_in_progress) then
{
    _isNearFeed = count ((position _caller) nearObjects ["Land_A_FuelStation_Feed", 10]) > 0;
 
    if (!_isNearFeed) then
    {
        titleText ["You must be near a fuel station pump.", "PLAIN DOWN", 3];
        titleFadeOut 3;
    }
    else
    {
        ib_refueling_in_progress = true;
 
        titleText ["Refueling", "PLAIN", 3];
 
        while {(vehicle _caller == _target) and (local _target)} do
        {
            private ["_velocity", "_cfcust"];
     
            _velocity = velocity _target;
            _cfcust = fuel _target;
 
            if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith { };
            if (_cfcust >= 1.0) exitWith { };
 
            sleep 0.5;
 
            _cfcust = _cfcust + 0.005;
 
            if (_cfcust >= 1.0) then { _cfcust = 1.0; };
 
            _target setFuel _cfcust;
        };
 
        titleFadeOut 1;
 
        ib_refueling_in_progress = false;
    };
};


Thanks mate, most helpful!
 
Hey i used the scipt for self refuel works great ,,but
me and a couple of guys was fixing up a helicopter then we where trying to pu some fuel in it with a 20L jerrycan that's when we noticed you can manually refuel any more . normally you scroll your mouse wheel and then it says fill with 20L or 5 L jerrycan but it's not even in there any more what's the problem ??
greets rebel
 
never mind i figured it out autorefuel is all good .. it was my self bloodbag script i deleted it now i can save my vehicles again and fuel it with jerry cans ...have to look for a new selfbloodbag script anyone an idea ? for 1.7.7.1 chenarus
 
Confirmed Working with Taviana_Epoch had a problem with battleeye kicks for #44 so I just delted the line running a private whitelist server anyhow so no need for it.. Now if I could get towing to work id be happy
 
Strange. I got this to work on Chenarus map, 1.7.7.1 dayz.st server last night. But today it doesn't work. Only thing I changed was _amount in the kh_actions.sqf from 0.003 to 0.002. Can't believe that would stop it from working?

Any ideas?

UPDATE:
I returned the setting for _amount back to 0.003 and now it works fine. Don't understand why changing that value would break the script?
 
Needing some help from someone.
Anytime i install this script on my DayZ.st server, when i go onto my player/vehicle map to see everything... all my player icons have 'error' in them, instead of their name.

I know it's the script because it wasn't like this before i installed this script. I had it happen when i had a regular Dayz server, now it's happening on my now Epoch server, Chernarus map.

Any help or knowledge on why it's doing this would be very helpful.
Thanks.

Image proof:
42bfaaed0643f2a12c15320b31e2995c.png
 
Sure about that?
It states that you won't receive support if you edit the mission.pbo or server.pbo

Nevermind, i'm guessing it's a problem on their end.
It just started working.
Honestly, go into the IRC or email them and they generally give you help, depends how you present your self when your emailing them.
 
Did you add this:

1 setFuel !"\"setFuel\"," !"z\addons\dayz_code\compile\local_setFuel.sqf" !"\"dayzSetFuel\"" !"dayzSetFuel_code" !"dayzSetFuel = _val;" !"Scripts\kh_actions.sqf" !"Scripts\kh_vehicle_refuel.sqf"

to the bottom of your scripts.txt in the BattleEye folder? Do this via FTP.

Like Danny Boy, I changed the "5" to a "1" at the beginning... and I no longer get kicked.
 
how to change the time to refule from 0% -100% ? i think its to fast on my server atm.

You can go into "kh_actions.sqf" and change "_amount= x;" where x is the percentage of fuel to be added per loop. I find "_amount= 0.02;" to be a nice number.
 
Anyone got a script for panthera2 epoch?, i've tried this one and it had a few text mods but it still doesn't work? any ideas on that to do, please
 
Sorry for digging, but I need help.

I'm trying to enable autorefuelling and already have kh_actions.sqf and kh_vehicle_refuel.sqf. I know I have to edit init.sqf on this line:

if (!isDedicated) then {
[] execVM "Scripts\kh_actions.sqf";

But I already have it edited with this for my debug monitor:

if (!isDedicated) then {
[] execVM "Scripts\custom_monitor.sqf";

What can I do to have both working together? I don't have any idea. Just started my own server.

Thank you.

Patrick
 
Why don't you just add [] execVM "Scripts\kh_actions.sqf"; below [] execVM "Scripts\custom_monitor.sqf"; so that it looks like the following?
Code:
if (!isDedicated) then {
[] execVM "Scripts\custom_monitor.sqf";
[] execVM "Scripts\kh_actions.sqf";
 
Back
Top