DayZ Chenarus Auto Refuel! All stations!

Ok so I am a total noob at this stuff, If I download it for Dayz Chernarus, can you give me like a complete guide? So I put it in the folder, but what do I edit and where do I find it to put in the little script so it does not #5 kick people? I am brand new to dayz servers.
 
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;
    };
};

Firstly, if I understand this, you need to be near Land_A_FuelStation_Feed to refuel. I don't understand what that is. I've found other Land_A_FuelStation but not with _Feed at the end.
Secondly, if the auto-refuel works only near a station, how do I make it possible near a fuel tank too.
Finally, what number in this code represents the speed of refuel?
 
Firstly, if I understand this, you need to be near Land_A_FuelStation_Feed to refuel. I don't understand what that is. I've found other Land_A_FuelStation but not with _Feed at the end.
Secondly, if the auto-refuel works only near a station, how do I make it possible near a fuel tank too.
Finally, what number in this code represents the speed of refuel?

If you look at the post attached below(post #99 in this thread).. I modified Seven's script to work with pumps and all tanks you can fill jerrycans at. There is also variables in the kh_actions.sqf file to change settings.

I modified the script that Seven posted to work with all the fuel tanks you can use with jerry cans and the gas pumps. I removed some code that wasn't needed and added messages for when the vehicle moves while fueling and when fueling is done. Added some variables to the kh_actions.sqf file (lines 6 & 7) for distance from tanks/pumps and amount of fuel per loop so it can be changed easily.

kh_actions.sqf - http://pastebin.com/rCW8sWCC
kh_vehicle_refuel.sqf - http://pastebin.com/6AmSQB8w
 
If you look at the post attached below(post #99 in this thread).. I modified Seven's script to work with pumps and all tanks you can fill jerrycans at. There is also variables in the kh_actions.sqf file to change settings.
Thank you so much!
One last thing, how do you add it to a Pwnoz0r server?
 
Hello, I am grateful to have shared this with us, here it worked without problems.

But I have a doubt. It would be possible to add other buildings of this code so that the vehicle can refueling?

For example: the "Land_A_FuelStation_Feed", works as a construction of refueling. If I switch to "Land_A_FuelStation_Shed", construction that is covering the gas station, would work as a refueling point. But I wonder how I do to have more of a construction working simultaneously, ie, the "Land_A_FuelStation_Feed" and "Land_A_FuelStation_Shed" running at the same time to accomplish the refueling in one or the other. I would adding other buildings in this code.

This would be possible?
I am grateful for any help!
 
So I've been trying to get this to work for a few hours now with no luck. I'm inserting the scripts exactly as the appear and making the folder in the mission.pbo but whenever I start up the server it tells me that it cannot locate the "scripts\kh_actions.sqf". I've tried sticking the 'scripts' folder into the pbo, into my A2OA folder, tried sticking the files into the pbo without the folder...

I've even tried moving the script around in the init file. Can anyone please help me out?

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;
    };
};
 
So I've been trying to get this to work for a few hours now with no luck. I'm inserting the scripts exactly as the appear and making the folder in the mission.pbo but whenever I start up the server it tells me that it cannot locate the "scripts\kh_actions.sqf". I've tried sticking the 'scripts' folder into the pbo, into my A2OA folder, tried sticking the files into the pbo without the folder...

I've even tried moving the script around in the init file. Can anyone please help me out?

Your init.sqf is like this?

Code:
if (!isDedicated) then {[] execVM "Scripts\kh_actions.sqf";
    //Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
I originally didn't have the

"[] execVM "Scripts\kh_actions.sqf";

on the same line as the

"if (!isdedicated) then {

line. But I just changed my init.sqf to look exactly like that one and still no luck.
 
very poor tutorial, doest say where to put the code given, its like giving some one your car and saying park it in Miami, where the fuck is it?!?!
 
Everyone getting kicked for script restriction #44 change the following:

Scripts.txt -

Change line 46 to the following:
PHP:
5 setFuel !"\"setFuel\"," !"z\addons\dayz_code\compile\local_setFuel.sqf" !"\"dayzSetFuel\"" !"dayzSetFuel_code" !"dayzSetFuel = _val;" !"Scripts\kh_actions.sqf" !"Scripts\kh_vehicle_refuel.sqf"
 
Everyone getting kicked for script restriction #44 change the following:

Scripts.txt -

Change line 46 to the following:
PHP:
5 setFuel !"\"setFuel\"," !"z\addons\dayz_code\compile\local_setFuel.sqf" !"\"dayzSetFuel\"" !"dayzSetFuel_code" !"dayzSetFuel = _val;" !"Scripts\kh_actions.sqf" !"Scripts\kh_vehicle_refuel.sqf"


Noob question, which scripts.txt do I change? I am using Dayz Control Center and there is like 6 scripts.txt with it...
 
Back
Top