Jump to content
amorelliku

VEHICLE RETURN GARAGE WHEN THE OWNERS IS FAR FROM. HOW TO DISABLE IT?

Recommended Posts

Pretty sure he is talking about fn_cleanup.sqf.

 

"fn_cleanup.sqf" is located in your life_server\Functions\Systems. 

 

You can edit the file to no longer delete vehicles, by commenting out this chunk of code.

/* {
        _protect = false;
        _veh = _x;
        _vehicleClass = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "vehicleClass");
        _fuel = 1;

        if (!isNil {_veh getVariable "NPC"} && {_veh getVariable "NPC"}) then {_protect = true;};

        if ((_vehicleClass in ["Car","Air","Ship","Armored","Submarine"]) && {!(_protect)}) then {
            if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {_fuel = (fuel _veh);};
            _dbInfo = _veh getVariable ["dbInfo",[]];
            _units = {(_x distance _veh < 300)} count playableUnits;
            if (count crew _x isEqualTo 0) then {
                switch (true) do {
                    case ((_x getHitPointDamage "HitEngine") > 0.7 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitLFWheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitLF2Wheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitRFWheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitRF2Wheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case (_units isEqualTo 0): {deleteVehicle _x; _deleted = true;};
                };
            };

            if (_deleted) then {
                waitUntil {isNull _veh};
                _deleted = false;
            };

            if (isNull _veh) then {
                if (count _dbInfo > 0) then {
                    _uid = _dbInfo select 0;
                    _plate = _dbInfo select 1;

                    _query = format ["UPDATE vehicles SET active='0', fuel='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate,_fuel];

                    [_query,1] call DB_fnc_asyncCall;
                };
            };
        };
    } forEach vehicles; */

 

The entire file should look something like this:

Spoiler
#include "\life_server\script_macros.hpp"
/*
    File: fn_cleanup.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Server-side cleanup script on vehicles.
    Sort of a lame way but whatever. Yep someone should look at it!
*/
private ["_deleted"];
_deleted = false;
for "_i" from 0 to 1 step 0 do {
    private ["_veh","_units","_fuel"];
    uiSleep (60 * 60);
    /*{ // -- Vehicle removal
        _protect = false;
        _veh = _x;
        _vehicleClass = getText(configFile >> "CfgVehicles" >> (typeOf _veh) >> "vehicleClass");
        _fuel = 1;

        if (!isNil {_veh getVariable "NPC"} && {_veh getVariable "NPC"}) then {_protect = true;};

        if ((_vehicleClass in ["Car","Air","Ship","Armored","Submarine"]) && {!(_protect)}) then {
            if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {_fuel = (fuel _veh);};
            _dbInfo = _veh getVariable ["dbInfo",[]];
            _units = {(_x distance _veh < 300)} count playableUnits;
            if (count crew _x isEqualTo 0) then {
                switch (true) do {
                    case ((_x getHitPointDamage "HitEngine") > 0.7 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitLFWheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitLF2Wheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitRFWheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case ((_x getHitPointDamage "HitRF2Wheel") > 0.98 && _units isEqualTo 0) : {deleteVehicle _x; _deleted = true;};
                    case (_units isEqualTo 0): {deleteVehicle _x; _deleted = true;};
                };
            };

            if (_deleted) then {
                waitUntil {isNull _veh};
                _deleted = false;
            };

            if (isNull _veh) then {
                if (count _dbInfo > 0) then {
                    _uid = _dbInfo select 0;
                    _plate = _dbInfo select 1;

                    _query = format ["UPDATE vehicles SET active='0', fuel='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate,_fuel];

                    [_query,1] call DB_fnc_asyncCall;
                };
            };
        };
    } forEach vehicles;*/

    // -- Delete ground virtual items.
    uiSleep (5 * 60); // -- 5 minute cool-down before next cycle.
    {
        if ((typeOf _x) in ["Land_BottlePlastic_V1_F","Land_TacticalBacon_F","Land_Can_V3_F","Land_CanisterFuel_F","Land_Suitcase_F","Land_PainKillers_F","Land_BottlePlastic_V2_F","Land_Defibrillator_F","Land_MobilePhone_smart_F","Land_SatellitePhone_F","ModuleExplosive_DemoCharge_F","Land_MultiMeter_F","Land_Ammobox_rounds_F"]) then {
            deleteVehicle _x;
        };
    } forEach (allMissionObjects "Thing");

    // -- Delete loose ground items.
    uiSleep (2 * 60);
    {
        deleteVehicle _x;
    } forEach (allMissionObjects "GroundWeaponHolder");
};

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.