Auto refuel

D. Jones

New Member
Does any one know the script for auto refuel for epidemic having a hard time finding it ive seen servers with it
Thank You
 

Humaine

New Member
I also would like to add this too... but I keep getting a Battle eye script error 241 that stops any players from joining when I enable it.
 

Gagi2

Valued Member!
to solve this script restriction you need to post the whole kickmessage... the regarding logfile and the scripts.txt

for the autorefuel script...
kh_actions.sqf
Code:
private ["_vehicle", "_vehicle_refuel_id"];
//Awesomely Edited by Seven, Then modified by Muddr
_vehicle = objNull;
diag_log "Running ""kh_actions"".";
 
_distance = 15; // Distance from object to display Refuel Message
_amount= 0.02; // 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 ["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;
 
        if (_vehicle != _currentVehicle) then {
            if (!isNull _vehicle) then {
                _vehicle removeAction _vehicle_refuel_id;
                _vehicle = objNull;
            };
 
            if (_currentVehicle != player && _isNearFeed && !(_currentVehicle isKindof "Bicycle")) then {  //change "Bicycle" to "Land" to allow only air vehicles to aut-refuel
                _vehicle = _currentVehicle;
 
                _vehicle_refuel_id = _vehicle addAction ["Refuel", "scripts\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;
}
kh_vehicle_refuel.sqf
Code:
private ["_target", "_caller", "_id"];
 
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_args = _this select 3;
_amount = _args select 0;
 
if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; };
 
if (!ib_refueling_in_progress) then {
 
        ib_refueling_in_progress = true;
 
        titleText ["Refueling", "PLAIN DOWN", 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 {
                        titleText ["Refueling Stopped", "PLAIN DOWN", 3];
                };
                if (_cfcust >= 1.0) exitWith {
                        titleText ["Done Refueling", "PLAIN DOWN", 3];
                };
 
                sleep 0.5;
 
                _cfcust = _cfcust + _amount;
 
                if (_cfcust >= 1.0) then { _cfcust = 1.0; };
 
                _target setFuel _cfcust;
        };
 
        titleFadeOut 1;
 
        ib_refueling_in_progress = false;
};
 

D. Jones

New Member
"PVDZ_veh_SetFuel" addPublicVariableEventHandler {(_this select 1) spawn loca"
04.09.2013 17:03:08: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #58 "{_x setDamage 1} forEach nearestObjects [getPos this,[],20];"
04.09.2013 17:03:08: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #58 "{_x setDamage 1} forEach nearestObjects [getPos this,["Land_Mil_Barracks_i"],50]"
04.09.2013 17:03:08: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #58 "{_x setDamage 1} forEach nearestObjects [getPos this,["Land_Mil_Barracks_i"],50]"
04.09.2013 17:03:08: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #58 "{_x setDamage 1} forEach nearestObjects [getPos this,["House"],3]"
04.09.2013 17:03:10: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #16 " Server init (ONLY ONCE or bad)"];
};

BIS_MPF_ServerPersistentCallsArray = [];
};
};




_library = [
"move",
"
04.09.2013 17:03:11: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #241 "andler {(_this select 1) spawn local_gutObject};

"PVDZ_veh_SetFuel" addPublicVariableEventHandler {(_this select 1) spawn loca"
04.09.2013 17:05:00: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #16 " Server init (ONLY ONCE or bad)"];
};

BIS_MPF_ServerPersistentCallsArray = [];
};
};




_library = [
"move",
"
04.09.2013 17:05:01: [AN]Agent7 (68.204.67.236:2374) 96be5db9e4ae58ced584612b671b468d - #241 "andler {(_this select 1) spawn local_gutObject};

"PVDZ_veh_SetFuel" addPublicVariableEventHandler {(_this select 1) spawn loca"
 

Gagi2

Valued Member!
as far as i can tell this kick message is NOT related to the autorefuel

need your scripts.txt to edit this...
if this is really a SCRIPT RESTRICTION and not another one?
seems like a publicvariable restriction or something?
in which logfile did you find this?
need the regarding txt file for this...
 

D. Jones

New Member
1 how do I upload the text file to the forum couldn't figure it out
2 I got it from the script log file
3 when I removed scripts error goes away
 

Chris Atkins

Valued Member!
Wow, thanks for that... that was helpful...
Sorry, man. Wasn't trying to be a dick. I had a moment of frustration last week after reading through numerous posts about people breaking their servers because they can't follow instructions or pay attention to detail. Unfortunately I lashed out at those whom are having problems. I apologize.

I know everyone wants to have all the bells and whistles on their servers to attract more players, but some things are better off left alone if people don't have the some form of scripting/understanding of what they are doing when editing PBO files.

Again, sincerest apologies for being a douche.
 

Chris Atkins

Valued Member!
No worries mate, I appreciate that you've replied like above. :)
This is the last line in my scripts.txt:
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"

It's green for good and working!

I know the original post says to put a "5" in front, although that was still kicking me. Use a "1" instead.

*Note: The exception above is one, single line.
 

Humaine

New Member
Thanks Chris,

I think I have tried that same line with "5" in my scripts.txt before, but I'll try it again.

I pasted in your line and just had to uncomment code in the ini.sqf.
 

Humaine

New Member
:) I did have a problem with where to position:

Code:
[] execVM "Scripts\kh_actions.sqf";
in the init.sqf file... as there seem to be another custom line in there.

Code:
[] spawn krx_fnc_effect;
I put the "actions" above the "spawn" code... as it wasn't working the other way round. Hopefully this doesn't cause any problems later. :/
 
Top