PHP Code:
//Script pulled from F2k Sel
//init: take=0; act1 = this addaction ["Take Fuel Can","carry.sqf",[0],1,false,true,"","player distance scase < 2"]
//Jerry Can starts at case 0 so first the player can pick it up
private ["_In_out","_man"];
////////////// checks for player in or out of car ////////////////
_in_car = {
_In_out = createTrigger["emptyDetector",[0,0,0]];
_In_out setTriggerArea [0,0,0,false];
_In_out setTriggerActivation ["any","present",True];
//_In_out setTriggerStatements["(vehicle player) != player and take == 1",";scase hideobject true;","scase hideobject false;"];// hides object
_In_out setTriggerStatements["(vehicle player) != player and take == 1","player action ['getout',nearestObject [player,'car']]; Hint 'Get out you idiot!';",""];// kicks you out if carrying
_return
};
////////// checks if player is dead ///////////////////
_evh_Killed = {
_man removeeventHandler ["killed",0];
_man addEventHandler ["killed", {
detach scase;hint "dead";
scase removeAction act1;
act1 = scase addaction ["Take Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
take=0;(_this select 0) removeeventHandler ["killed",0]; } ];
_return
};
switch (take) do
{
//pick up jerry can
case 0:
{
_scase = _this select 0;
_man = _this select 1;
_fuel = scase getvariable "fuel";
_fuelCount = _fuel;
if (_fuel >=1) then {_fuelCount=10; _fuel=10; titleText ["This feels full","PLAIN"]};
if (_fuel > 0 and _fuelCount < 1) then {_fuelCount=_fuel*10};
if (_fuelCount > 5 and _fuelCount < 10) then {titleText ["This feels somewhat full","PLAIN"]};
if (_fuelCount >=3 and _fuelCount < 5 ) then {titleText ["This feels half way full","PLAIN"]};
if (_fuelCount >=1 and _fuelCount < 3 ) then {titleText ["This feels close to empty","PLAIN"]};
if (_fuel == 0) then {titleText ["This feels empty","PLAIN"]};
_scase attachto [_man, [-0.23,0,-0.15],"Pelvis"];
_scase setdir 75;
_scase removeAction act1;
act1 = _man addaction ["Drop Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
take=1;scase = _scase;_man call _in_car; _man call _evh_Killed;
hintSilent format ["Jerry Can Has %1 Liters of Fuel",_fuelCount];
};
case 1:
{
_man = _this select 0;
detach scase;
scase setvelocity[0,0,-.3];
_man removeAction act1;
act1 = scase addaction ["Take Jerry Can","scripts\take_fill_attach\carry.sqf","",1,false,true,""];
take=0;deletevehicle _In_out;
_man removeeventHandler ["killed",0];
};
};
PHP Code:
//Script created with major help from F2k Sel
_fuel = scase getvariable "fuel";
_fuelCount = _fuel;
if (_fuel >=1) then {_fuelCount=10; _fuel=10};
if (_fuel > 0 and _fuel < 1) then {_fuelCount=_fuel*10};
if (_fuel == 0) exitwith {Hint "Your can is empty"};
_rest = 10-_fuelCount;
titleText ["Refueling","PLAIN"];
scase say ["Candecant",5]; // sound for fueling truck (clip is 10secs)
truck_start removeaction act3;
while {sleep 1; _fuelCount >0 } do {
_fuelCount=_fuelCount-1;
if (_fuelCount < 0) then {_fuelCount=0};
hintsilent format ["Jerry Can Has %1 Liters of Fuel",_fuelCount];
};
sleep _rest;
scase setvariable ["fuel",_fuel,true];
truck_start setfuel _fuel;
titleText ["Truck refueled","PLAIN"];