Jump to content

[RESOLVED] refuel not working


Nox

Recommended Posts

Hello

 

Many customer have an issue about refuel truck ....

 

On my test server , all work, on my dedicated server it's doesn't work

 

Test server = Dedicated Server

 

some clues ?

 

Hypothese : Refuel Truck in database

Link to comment
Share on other sites

Not a fix but as a work around. A custom Refuel Script and add in the vehicle classes?

 

You can use the kh_actions and kh_vehicle_refuel from the custom pack as an example.

_distance = 15; // 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;
// Refuel Trucks
_countFuel = (count ((position _currentVehicle) nearObjects ["UralRefuel_TK_EP1_DZ", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["V3S_Refuel_TK_GUE_EP1_DZ", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["KamazRefuel_DZ", _distance]));
_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["MtvrRefuel_DES_EP1_DZ", _distance]));
// Fuel Tanks/Stations
_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;
Not tested however, but should work I guess.

 

Link to comment
Share on other sites

  • 4 weeks later...

I got refuel at the pumps but no the refuel trucks.

Can someone post there refuel scripts?
http://pastebin.com/

 

I tried this

UPDATE `object_data` SET `Classname`='CH_47F_EP1_DZ' WHERE `Classname`='CH_47F_EP1';
UPDATE `object_data` SET `Classname`='UH1Y_DZ' WHERE `Classname`='UH1Y';
UPDATE `object_data` SET `Classname`='MV22_DZ' WHERE `Classname`='MV22';
UPDATE `object_data` SET `Classname`='UH60M_EP1_DZ' WHERE `Classname`='UH60M_EP1';
UPDATE `object_data` SET `Classname`='KamazRefuel_DZ' WHERE `Classname`='KamazRefuel';
UPDATE `object_data` SET `Classname`='UralRefuel_TK_EP1_DZ' WHERE `Classname`='UralRefuel_TK_EP1';
UPDATE `object_data` SET `Classname`='MtvrRefuel_DES_EP1_DZ' WHERE `Classname`='MtvrRefuel_DES_EP1';
UPDATE `object_data` SET `Classname`='V3S_Refuel_TK_GUE_EP1_DZ' WHERE `Classname`='V3S_Refuel_TK_GUE_EP1'; 

#1146 - Table '########.object_data' doesn't exist 

I took out my instance ID :) 

Thanks 

Link to comment
Share on other sites

Keep in mind that in SQL, table names are case sensitive.  So your lines should read "Object_DATA", for the table name.

 

Here is my refuel script that is verified working for all fueling sources:

private ["_vehicle", "_vehicle_refuel_id"];
//Awesomely Edited by Seven, Then modified by Muddr, Then modified again by Darth_Rogue
_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]));
		_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]));
		_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["V3S_Refuel_TK_GUE_EP1_DZ", _distance]));
		_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["UralRefuel_TK_EP1_DZ", _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_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;
}
Link to comment
Share on other sites

 

Keep in mind that in SQL, table names are case sensitive.  So your lines should read "Object_DATA", for the table name.

 

Here is my refuel script that is verified working for all fueling sources:

private ["_vehicle", "_vehicle_refuel_id"];
//Awesomely Edited by Seven, Then modified by Muddr, Then modified again by Darth_Rogue
_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]));
		_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]));
		_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["V3S_Refuel_TK_GUE_EP1_DZ", _distance]));
		_countFuel = _countFuel + (count ((position _currentVehicle) nearObjects ["UralRefuel_TK_EP1_DZ", _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_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;
}

 

Please forgive my ignorance, But where would I need to add this code and into which file?

 

Edit:  So if I understand this correctly, I need to place this script in my mission file and point the init.sqf towards it by adding for example: [] execVM "scripts\autofuel.sqf";  (assuming I name the script autofuel.sqf and place it in a "scripts" folder in my mission files) ?

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...