use the new one.....
Ye i didnt check 1st post. Sorry bro...working fine.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
use the new one.....
class Sensors
{
items=1;
class Item0
{
position[]={7023.45,-1.9073486e-006,11552.5};
a=10;
b=10;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
name="REFUEL";
expCond="this and ((getpos (thislist select 0)) select 2 < 1)";
expActiv="_xhandle= [(thislist select 0)] execVM ""scriptsMZ\MZ_reload.sqf"";";
class Effects
{
};
};
};
[] execVM "Scripts\kh_actions.sqf";
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;
}
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;
};
};
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 alsowhy 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", "_isNearQuad", "_isNearQuadCount", "_veh_up_vector"]; _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; }; };