Jump to content
  • 0

Virtual garage partially working, help requested


Th3-Hunter333

Question

After many long hours trying to get virtual garage from overheat working on epoch 106 it is almost fully working just having some strange minor errors trying to fix it and am looking for some help now with it

First error is it is spamming Garage locked in red over and over (nonstop even when walking away from the garage)

This here is the fn_selfactions where i think that error is at

scriptName "Functions\misc\fn_selfActions.sqf";
/***********************************************************
    ADD ACTIONS FOR SELF
    - Function
    - [] call fnc_usec_selfActions;
************************************************************/
if (dayz_actionInProgress) exitWith {};
private ["_canPickLight","_text","_dir","_canDoThis","_w2m","_bb","_waterHoles","_unlock","_lock","_totalKeys","_temp_keys","_temp_keys_names",
"_hasKey","_oldOwner","_hasAttached","_isZombie","_isHarvested","_isMan","_isFuel","_hasRawMeat","_hastinitem","_player_deleteBuild",
"_player_lockUnlock_crtl","_displayName","_hasIgnators","_menu","_menu1","_allowTow","_liftHeli","_found","_posL","_posC","_height","_attached",
"_combi","_findNearestGen","_humanity_logic","_low_high","_cancel","_buy","_buyV","_humanity","_traderMenu","_warn","_typeOfCursorTarget",
"_isVehicle","_isBicycle","_isDestructable","_isGenerator","_ownerID","_isVehicletype","_hasBarrel","_hasFuel20","_hasFuel5","_hasEmptyFuelCan",
"_itemsPlayer","_hasToolbox","_hasbottleitem","_isAlive","_isPlant","_istypeTent","_upgradeItems","_isDisallowRefuel","_isDog",
"_isModular","_isModularDoor","_isHouse","_isGate","_isFence","_isLockableGate","_isUnlocked","_isOpen","_isClosed","_ownerArray","_ownerBuildLock",
"_ownerPID","_speed","_dog","_vehicle","_inVehicle","_cursorTarget","_primaryWeapon","_currentWeapon","_magazinesPlayer","_onLadder","_canDo",
"_nearLight","_vehicleOwnerID","_hasHotwireKit","_isPZombie","_dogHandle","_allowedDistance","_id","_upgrade","_weaponsPlayer","_hasCrowbar",
"_allowed","_hasAccess","_uid"];

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_cursorTarget = cursorTarget;
_primaryWeapon = primaryWeapon player;
_currentWeapon = currentWeapon player;
_magazinesPlayer = magazines player;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);
//_canDrink = count nearestObjects [getPosATL player, ["Land_pumpa","Land_water_tank"], 2] > 0;
_uid = getPlayerUID player;
_nearLight = nearestObject [player,"LitObject"];
_canPickLight = false;
_vehicleOwnerID = _vehicle getVariable ["CharacterID","0"];
_hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;
_isPZombie = player isKindOf "PZombie_VB";
_dogHandle = player getVariable ["dogID",0];

if (!isNull _nearLight) then {
    if (_nearLight distance player < 4) then {
        _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
    };
};

//Grab Flare
if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
    if (s_player_grabflare < 0) then {
        _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
        s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true];
        s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true];
    };
} else {
    player removeAction s_player_grabflare;
    player removeAction s_player_removeflare;
    s_player_grabflare = -1;
    s_player_removeflare = -1;
};

if (s_player_equip_carry < 0) then {
    if (dayz_onBack != "" && { !_inVehicle && { !_onLadder && { !r_player_unconscious } } }) then {
        dz_plr_carryActionItem = dayz_onBack;
        _text = getText (configFile >> "CfgWeapons" >> dz_plr_carryActionItem >> "displayName");
        s_player_equip_carry = player addAction [
            format [localize "STR_ACTIONS_WEAPON", _text],
            "\z\addons\dayz_code\actions\player_switchWeapon_action.sqf",
            nil, 0.5, false, true];
    };
} else {
    if (dayz_onBack != dz_plr_carryActionItem || { _inVehicle || { _onLadder || { r_player_unconscious } } } ) then {
        player removeAction s_player_equip_carry;
        s_player_equip_carry = -1;
    };
};

/*if (dayz_onBack != "" /*&& !dayz_onBackActive && !_inVehicle && !_onLadder && !r_player_unconscious) then {
    if (s_player_equip_carry < 0) then {
        _text = getText (configFile >> "CfgWeapons" >> dayz_onBack >> "displayName");
        s_player_equip_carry = player addAction [format[localize "STR_ACTIONS_WEAPON", _text], "\z\addons\dayz_code\actions\player_switchWeapon_action.sqf", nil, 0.5, false, true];
    };
} else {
    player removeAction s_player_equip_carry;
    s_player_equip_carry = -1;
};*/

//fishing
if ((_currentWeapon in Dayz_fishingItems) && {!dayz_fishingInprogress} && {!_inVehicle} && {!dayz_isSwimming}) then {
    if (s_player_fishing < 0) then {
        s_player_fishing = player addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf",player, 0.5, false, true];
    };
} else {
    player removeAction s_player_fishing;
    s_player_fishing = -1;
};
if ((_primaryWeapon in Dayz_fishingItems) && {!dayz_fishingInprogress} && {_inVehicle && (driver _vehicle != player)}) then {
    if (s_player_fishing_veh < 0) then {
        s_player_fishing_veh = _vehicle addAction [localize "STR_ACTION_CAST", "\z\addons\dayz_code\actions\player_goFishing.sqf",_vehicle, 0.5, false, true];
    };
} else {
    _vehicle removeAction s_player_fishing_veh;
    s_player_fishing_veh = -1;
};

_canDoThis=false;
if (_canDo && !_inVehicle && !dayz_isSwimming) then {
    {
        _waterHoles = if (typeOf _x == "waterHoleProxy") then {nearestObjects [_x, [], 1];} else {[_x];};
        {
            _w2m = _x worldToModel (getPosATL player);
            _bb = (boundingbox _x) select 1;
            _dir = [player, _x] call BIS_fnc_relativeDirTo; if (_dir > 180) then {_dir = _dir - 360};
            if (((abs _dir < 45) && {(_x distance player < 2.22)})  // wells, kasna, pumpa
                or {((("" == typeOf _x) && ((_w2m select 2) < 0.05)) && {((abs(_w2m select 0) < (_bb select 0)) && (abs(_w2m select 1) < (_bb select 1)))})}) exitWith { // ponds
                _canDoThis = true;
            };
        } count _waterHoles;
        if (_canDoThis) exitWith {
            if (s_player_Drinkfromhands < 0) then {
                s_player_Drinkfromhands = player addAction [localize "STR_ACTIONS_DRINK2", "\z\addons\dayz_code\actions\player_drinkWater.sqf",player, 0.5, false, true];
            };
        };
    } foreach nearestObjects [player, ["waterHoleProxy", "Land_pumpa"], 50];
};
if (!_canDoThis && s_player_Drinkfromhands >= 0) then {
    player removeAction s_player_Drinkfromhands;
    s_player_Drinkfromhands = -1;
};

if (_inVehicle) then {
    DZE_myVehicle = _vehicle;
    if (_vehicleOwnerID != "0" && _canDo) then {
        if (s_player_lockUnlockInside_ctrl < 0) then {
            _totalKeys = call epoch_tempKeys;
            _temp_keys = _totalKeys select 0;
            _temp_keys_names = _totalKeys select 1;    
            _hasKey = _vehicleOwnerID in _temp_keys;
            _oldOwner = (_vehicleOwnerID == _uid);
            _text = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "displayName");
            if (locked DZE_myVehicle) then {
                if (_hasKey || _oldOwner) then {
                    _unlock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[DZE_myVehicle,(_temp_keys_names select (parseNumber _vehicleOwnerID))], 2, false, true];
                    s_player_lockUnlockInside set [count s_player_lockUnlockInside,_unlock];
                    s_player_lockUnlockInside_ctrl = 1;
                } else {
                    if (_hasHotwireKit) then {
                        _unlock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",DZE_myVehicle, 2, true, true];
                    } else {
                        _unlock = DZE_myVehicle addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",DZE_myVehicle, 2, true, true];
                    };
                    s_player_lockUnlockInside set [count s_player_lockUnlockInside,_unlock];
                    s_player_lockUnlockInside_ctrl = 1;
                };
            } else {
                if (_hasKey || _oldOwner) then {
                    _lock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",DZE_myVehicle, 1, false, true];
                    s_player_lockUnlockInside set [count s_player_lockUnlockInside,_lock];
                    s_player_lockUnlockInside_ctrl = 1;
                };
            };
        };
    } else {
        {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = [];
        s_player_lockUnlockInside_ctrl = -1;
    };
} else {
    {DZE_myVehicle removeAction _x} count s_player_lockUnlockInside;s_player_lockUnlockInside = [];
    s_player_lockUnlockInside_ctrl = -1;
};

if (DZE_HeliLift) then {
    _hasAttached = _vehicle getVariable["hasAttached",false];
    if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) < 30} && {speed _vehicle < 5} && {typeName _hasAttached == "OBJECT"}) then {
        if (s_player_heli_detach < 0) then {
            dayz_myLiftVehicle = _vehicle;
            s_player_heli_detach = dayz_myLiftVehicle addAction [localize "STR_EPOCH_ACTIONS_DETACHVEHICLE","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true];
        };
    } else {
        dayz_myLiftVehicle removeAction s_player_heli_detach;
        s_player_heli_detach = -1;
    };
};

if (DZE_HaloJump) then {
    if (_inVehicle && {_vehicle isKindOf "Air"} && {(([_vehicle] call FNC_getPos) select 2) > 400}) then {
        if (s_halo_action < 0) then {
            DZE_myHaloVehicle = _vehicle;
            s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true];
        };
    } else {
        DZE_myHaloVehicle removeAction s_halo_action;
        s_halo_action = -1;
    };
};

if (DZE_NameTags > 0) then {
    if (s_player_showname < 0 && !_isPZombie) then {
        if (DZE_NameTags < 2) then {
            s_player_showname = 1;
            player setVariable["DZE_display_name",true,true];
        } else {
            s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false];
            s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false];
        };
    };
};

if (_isPZombie) then {
    if (s_player_attack < 0) then {
        s_player_attack = player addAction [localize "STR_EPOCH_ACTIONS_ATTACK", "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf", _cursorTarget, 6, false, true];
    };
    if (s_player_callzombies < 0) then {
        s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\pzombie\call_zombies.sqf",player, 5, true, false];
    };
    if (s_player_pzombiesvision < 0) then {
        s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
    };
    if (!isNull _cursorTarget && (player distance _cursorTarget < 3)) then {
        _isZombie = _cursorTarget isKindOf "zZombie_base";
        _isHarvested = _cursorTarget getVariable["meatHarvested",false];
        _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
        if (!alive _cursorTarget && _isMan && !_isZombie && !_isHarvested) then {
            if (s_player_pzombiesfeed < 0) then {
                s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",_cursorTarget, 3, true, false];
            };
        } else {
            player removeAction s_player_pzombiesfeed;
            s_player_pzombiesfeed = -1;
        };
    } else {
        player removeAction s_player_pzombiesfeed;
        s_player_pzombiesfeed = -1;
    };
};

// Increase distance only if AIR or SHIP
_allowedDistance = if ((_cursorTarget isKindOf "Air") or (_cursorTarget isKindOf "Ship")) then {8} else {4};

if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cursorTarget < _allowedDistance) && _canDo) then {
//Has some kind of target
    _typeOfCursorTarget = typeOf _cursorTarget;
    _isVehicle = _cursorTarget isKindOf "AllVehicles";
    _isBicycle = _cursorTarget isKindOf "Bicycle";
    _isMan = _cursorTarget isKindOf "Man"; //includes animals and zombies
    _isDestructable = _cursorTarget isKindOf "BuiltItems";
    _isGenerator = _cursorTarget isKindOf "Generator_DZ";
    //_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"]; //Checked in player_flipvehicle
    _isFuel = false;
    _hasBarrel = "ItemFuelBarrel" in _magazinesPlayer;
    _hasFuel20 = "ItemJerrycan" in _magazinesPlayer;
    _hasFuel5 = "ItemFuelcan" in _magazinesPlayer;
    _hasEmptyFuelCan = (("ItemJerrycanEmpty" in _magazinesPlayer) || ("ItemFuelcanEmpty" in _magazinesPlayer) || ("ItemFuelBarrelEmpty" in _magazinesPlayer));
    _itemsPlayer = items player;
    _weaponsPlayer = weapons player;
    _hasCrowbar = "ItemCrowbar" in _itemsPlayer or "MeleeCrowbar" in _weaponsPlayer or dayz_onBack == "MeleeCrowbar";
    _hasToolbox = "ItemToolbox" in _itemsPlayer;
    _hasbottleitem = (("ItemWaterBottle" in _magazinesPlayer) || ("ItemWaterBottleInfected" in _magazinesPlayer) || ("ItemWaterBottleSafe" in _magazinesPlayer));
    _isAlive = alive _cursorTarget;
    _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
    _isPlant = _typeOfCursorTarget in Dayz_plants;
    _istypeTent = (_cursorTarget isKindOf "TentStorage_base") or (_cursorTarget isKindOf "IC_Tent");
    _upgradeItems = ["TentStorage","TentStorage0","TentStorage1","TentStorage2","TentStorage3","StashSmall","StashSmall1","StashSmall2","StashSmall3","StashSmall4","StashMedium","StashMedium1","StashMedium2","StashMedium3","DomeTentStorage","DomeTentStorage0","DomeTentStorage1","DomeTentStorage2","DomeTentStorage3","DomeTentStorage4"];
    _characterID = _cursorTarget getVariable ["CharacterID","0"];
    
    if (DZE_permanentPlot) then {
        _id = _uid;
        _ownerID = _cursorTarget getVariable ["ownerPUID","0"];
    } else {
        _id = dayz_characterID;
        _ownerID = _characterID;
    };

    _isDisallowRefuel = _typeOfCursorTarget in ["M240Nest_DZ","MMT_Civ","MMT_USMC","Old_bike_TK_CIV_EP1","Old_bike_TK_INS_EP1"];    
    _isDog = (_cursorTarget isKindOf "Pastor" || _cursorTarget isKindOf "Fin");
    _isModular = _cursorTarget isKindOf "ModularItems";
    _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];
    _player_deleteBuild = false;
    _player_lockUnlock_crtl = false;
    
    //fuel tanks
    if (_hasEmptyFuelCan) then {
        {
            if (_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
        } count dayz_fuelsources;
    };

    //remove gathered plant if empty
    if (_isPlant) then {
        _cursorTarget call player_gather;
    };

    //flip vehicle
    if (_isVehicle && {!_isMan} && {!(canMove _cursorTarget)} && {_isAlive} && {player distance _cursorTarget >= 2} && {(count (crew _cursorTarget))== 0} && {((vectorUp _cursorTarget) select 2) < 0.5}) then {
        if (s_player_flipveh < 0) then {
            s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true];
        };
    } else {
        player removeAction s_player_flipveh;
        s_player_flipveh = -1;
    };
    
    //Allow player to fill Fuel can
    if (_hasEmptyFuelCan && {_isFuel} && {!a_player_jerryfilling} && {_isAlive}) then {
        if (s_player_fillfuel < 0) then {
            s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",_cursorTarget, 1, false, true];
        };
    } else {
        player removeAction s_player_fillfuel;
        s_player_fillfuel = -1;
    };
    
    if (damage _cursorTarget < 1) then {
        //Allow player to fill vehicle 210L
        if (_hasBarrel && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then {
            if (s_player_fillfuel210 < 0) then {
                s_player_fillfuel210 = player addAction [format[localize "str_actions_medical_10",_text,"210"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelBarrel",_cursorTarget], 0, true, true, "", "'ItemFuelBarrel' in magazines player"];
            };
        } else {
            player removeAction s_player_fillfuel210;
            s_player_fillfuel210 = -1;
        };
        
        //Allow player to fill vehicle 20L
        if (_hasFuel20 && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then {
            if (s_player_fillfuel20 < 0) then {
                s_player_fillfuel20 = player addAction [format[localize "str_actions_medical_10",_text,"20"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemJerrycan",_cursorTarget], 0, true, true, "", "'ItemJerrycan' in magazines player"];
            };
        } else {
            player removeAction s_player_fillfuel20;
            s_player_fillfuel20 = -1;
        };

        //Allow player to fill vehicle 5L
        if (_hasFuel5 && {!_isMan} && {_isVehicle} && {fuel _cursorTarget < 1} && {!a_player_jerryfilling} && {!_isDisallowRefuel}) then {
            if (s_player_fillfuel5 < 0) then {
                s_player_fillfuel5 = player addAction [format[localize "str_actions_medical_10",_text,"5"], "\z\addons\dayz_code\actions\refuel.sqf",["ItemFuelcan",_cursorTarget], 0, true, true, "", "'ItemFuelcan' in magazines player"];
            };
        } else {
            player removeAction s_player_fillfuel5;
            s_player_fillfuel5 = -1;
        };
        /*
            Vanilla generator is currently not functional.
            Vanilla generator refuel actions removed for now.
            Epoch generator fill action is below.
        */
        //Allow player to siphon vehicles
        if (_hasEmptyFuelCan && {!_isMan} && {_isVehicle} && {!_isBicycle} && {!a_player_jerryfilling} && {fuel _cursorTarget > 0}) then {
            if (s_player_siphonfuel < 0) then {
                s_player_siphonfuel = player addAction [format[localize "str_siphon_start"], "\z\addons\dayz_code\actions\siphonFuel.sqf",_cursorTarget, 0, true, true];
            };
        } else {
            player removeAction s_player_siphonfuel;
            s_player_siphonfuel = -1;
        };
    } else {
        player removeAction s_player_fillfuel210;
        s_player_fillfuel210 = -1;
        player removeAction s_player_fillfuel20;
        s_player_fillfuel20 = -1;
        player removeAction s_player_fillfuel5;
        s_player_fillfuel5 = -1;
        player removeAction s_player_siphonfuel;
        s_player_siphonfuel = -1;
    };
    
    //Fireplace Actions check
    if ((_cursorTarget call isInflamed) or (inflamed _cursorTarget)) then {
        _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
        _hastinitem = {_x in boil_tin_cans} count _magazinesPlayer > 0;
        
    //Cook Meat    
        if (_hasRawMeat && !a_player_cooking) then {
            if (s_player_cook < 0) then {
                s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true];
            };
        }; 
    //Boil Water
        if (_hastinitem && _hasbottleitem && !a_player_boil) then {
            if (s_player_boil < 0) then {
                s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true];
            };
        };
    } else {
        if (a_player_cooking) then {
            player removeAction s_player_cook;
            s_player_cook = -1;
        };
        if (a_player_boil) then {
            player removeAction s_player_boil;
            s_player_boil = -1;
        };
    };
    
//    Not needed.
/*
    if(_cursorTarget == dayz_hasFire) then {
        if ((s_player_fireout < 0) && !(_cursorTarget call isInflamed) && (player distance _cursorTarget < 3)) then {
            s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true];
        };
    } else {
        player removeAction s_player_fireout;
        s_player_fireout = -1;
    };
*/
    if (_isAlive) then {
        //Allow player to delete objects
        if (_isDestructable || {((_typeOfCursorTarget in DZE_isWreck) or (_typeOfCursorTarget in DZE_isWreckBuilding))} || {(_typeOfCursorTarget in DZE_isRemovable)}) then {
            if (_hasToolbox && _hasCrowbar) then {
                _player_deleteBuild = true;
            };
        };    

        if (_isModular || _isModularDoor || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
            if (_hasToolbox && _hasCrowbar) then {
                _hasAccess = [player, _cursorTarget] call FNC_check_access;
                if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
                    _player_deleteBuild = true;
                };
            };
        };
        
        if (_isVehicle) then {
            if ((_characterID != "0") && {!_isMan}) then {
                _player_lockUnlock_crtl = true;
            };
        };
    };
    
    if (_player_deleteBuild) then {
        if (s_player_deleteBuild < 0) then {
            s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, false, true];
        };
    } else {
        player removeAction s_player_deleteBuild;
        s_player_deleteBuild = -1;
    };

    //remove Own objects
    if (_ownerID == _id) then {
        //upgrade items
        if (_typeOfCursorTarget in _upgradeItems) then {
            if (s_player_upgradestorage < 0) then {
                if (isText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "Upgrade" >> "create")) then {
                    _displayName = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
                    s_player_upgradestorage = player addAction [format[localize "str_upgrade",_displayName], "\z\addons\dayz_code\actions\object_upgradeStorage.sqf",_cursorTarget, 0, false, true];
                };
            };
        } else {
            player removeAction s_player_upgradestorage;
            s_player_upgradestorage = -1
        };
        if (_istypeTent) then {
            //Packing my tent
            if (s_player_packtent < 0) then {
                s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true];
            };
        } else {
            player removeAction s_player_packtent;
            s_player_packtent = -1;
        };
    } else {
        player removeAction s_player_upgradestorage;
        s_player_upgradestorage = -1;
        player removeAction s_player_packtent;
        s_player_packtent = -1;
    };
    //other tents
    if (_istypeTent) then {
        //destroy tents
        //Located in variables Dayz_Ignators = ["ItemMatchbox","Item5Matchbox","Item4Matchbox","Item3Matchbox","Item2Matchbox","Item1Matchbox"];
        _hasIgnators = {_x in Dayz_Ignators} count _itemsPlayer > 0;
        if ((_hasFuel20 or _hasFuel5 or _hasBarrel) && _hasIgnators) then {
            if (s_player_destorytent < 0) then {
                s_player_destorytent = player addAction [localize "str_actions_self_destorytent", "\z\addons\dayz_code\actions\player_destroyTent.sqf",_cursorTarget, 0, false, true];
            };
        } else {
            player removeAction s_player_destorytent;
            s_player_destorytent = -1;
        };    
        if (_typeOfCursorTarget in ["IC_DomeTent","IC_Tent"]) then {
            if (s_player_packtentinfected < 0) then {
                s_player_packtentinfected = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true];
            };
        } else {
            player removeAction s_player_packtentinfected;
            s_player_packtentinfected = -1;
        };
        //sleep
        if (s_player_sleep < 0) then {
            s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true];
        };
    } else {
        player removeAction s_player_sleep;
        s_player_sleep = -1;
    };
/*    
    //Carbomb
    _hasCarBomb = "ItemCarBomb" in _magazinesPlayer;
    if (((_cursorTarget isKindOf "Car") || (_cursorTarget isKindOf "Air") || (_cursorTarget isKindOf "Motorcycle")) && _hasCarBomb) then {
        if (s_player_attach_bomb < 0) then {
            s_player_attach_bomb = player addAction [localize "str_bombAttach", "\z\addons\dayz_code\actions\player_attach_bomb.sqf",_cursorTarget, 3, true, true];
        };
    } else {
            player removeAction s_player_attach_bomb;
            s_player_attach_bomb = -1;
    };
*/
    //Repairing Vehicles
    if (_isVehicle && {!_isMan} && {dayz_myCursorTarget != _cursorTarget} && {_hasToolbox} && {damage _cursorTarget < 1} && {_typeOfCursorTarget != "M240Nest_DZ"}) then {
        if (s_player_repair_crtl < 0) then {
            dayz_myCursorTarget = _cursorTarget;
            _menu = dayz_myCursorTarget addAction [localize "str_actions_repairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false];
            if (!_isBicycle) then { //Bike wheels should not give full size tires. Also model does not update to show removed wheels.
                if (!DZE_salvageLocked) then {
                    if (!locked _cursorTarget) then {
                        _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
                        s_player_repairActions set [count s_player_repairActions,_menu1];
                    };
                } else {
                    _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false];
                    s_player_repairActions set [count s_player_repairActions,_menu1];
                };
            };
            s_player_repairActions set [count s_player_repairActions,_menu];
            s_player_repair_crtl = 1;
        } else {
            {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;
            s_player_repairActions = [];
            s_player_repair_crtl = -1;
        };
    };
    /* //Vanilla base building currently not used in Epoch
    // House locking and unlocking
    _isHouse = _typeOfCursorTarget in ["SurvivorWorkshopAStage5", "SurvivorWorkshopBStage5", "SurvivorWorkshopCStage5"];
    _isGate = _typeOfCursorTarget in ["WoodenGate_1","WoodenGate_2","WoodenGate_3","WoodenGate_4","MetalGate_1","MetalGate_2","MetalGate_3","MetalGate_4"];
    _isFence = _typeOfCursorTarget in ["WoodenFence_1","WoodenFence_2","WoodenFence_3","WoodenFence_4","WoodenFence_5","WoodenFence_6","MetalFence_1","MetalFence_2","MetalFence_3","MetalFence_4","MetalFence_5","MetalFence_6","MetalFence_7"];

    //Only the owners can lock the gates
    _isLockableGate = _typeOfCursorTarget in ["WoodenGate_2","WoodenGate_3","WoodenGate_4","MetalGate_2","MetalGate_3","MetalGate_4"];
    _isUnlocked = _cursorTarget getVariable ["isOpen","0"] == "1";

    //Allow the gates to be opened when not locked by anyone
    _isOpen = ((_cursorTarget animationPhase "DoorL") == 1) || ((_cursorTarget animationPhase "DoorR") == 1);
    _isClosed = ((_cursorTarget animationPhase "DoorL") == 0) || ((_cursorTarget animationPhase "DoorR") == 0);
    
    //[["ownerArray",["PID"]]]
    _ownerArray = _cursorTarget getVariable ["ownerArray",["0"]];
    _ownerBuildLock = _cursorTarget getVariable ["BuildLock",false];    
    _ownerPID = (_ownerArray select 0);
    
    // open Gate
    if (_isGate && _isClosed && _isUnlocked) then {
        if (s_player_openGate < 0) then {
            s_player_openGate = player addAction [localize "STR_DN_OUT_O_GATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Open"], 1, true, true];
        };
    } else {
        player removeAction s_player_openGate;
        s_player_openGate = -1;
    };
    // Close Gate
    if (_isGate && _isOpen && _isUnlocked) then {
        if (s_player_CloseGate < 0) then {
            s_player_CloseGate = player addAction [localize "STR_DN_OUT_C_GATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Close"], 1, true, true];
        };
    } else {
        player removeAction s_player_CloseGate;
        s_player_CloseGate = -1;
    };
    // Set
    if ((_isHouse or _isLockableGate) && (_ownerPID == _uid) && !_isUnlocked && _isClosed) then {
        if (s_player_setCode < 0) then {
            s_player_setCode = player addAction [localize "STR_BLD_ACTIONS_SETLOCKCODE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Set"], 1, true, true];
        };
    } else {
        player removeAction s_player_setCode;
        s_player_setCode = -1;
    };
    //Lock Build point
    if ((_isFence or _isGate) && (_ownerPID == _uid) && !_ownerBuildLock) then {
        if (s_player_BuildLock < 0) then {
            s_player_BuildLock = player addAction [localize "STR_BLD_ACTIONS_LOCKBUILD", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"BuildLock"], 1, true, true];
        };
    } else {
        player removeAction s_player_BuildLock;
        s_player_BuildLock = -1;
    };
    //UnLock Build point
    if ((_isFence or _isGate) && (_ownerPID == _uid) && _ownerBuildLock) then {
        if (s_player_BuildUnLock < 0) then {
            s_player_BuildUnLock = player addAction [localize "STR_BLD_ACTIONS_UNLOCKBUILD", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"BuildUnLock"], 1, true, true];
        };
    } else {
        player removeAction s_player_BuildUnLock;
        s_player_BuildUnLock = -1;
    };
    // Unlock Gate/House
    if ((_isHouse or _isLockableGate) && !_isUnlocked && _isClosed) then {
        if (s_player_unlockhouse < 0) then {
            s_player_unlockhouse = player addAction [localize "STR_BLD_ACTIONS_UNLOCKGATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Unlock"], 1, true, true];
        };
    } else {
        player removeAction s_player_unlockhouse;
        s_player_unlockhouse = -1;
    };
    // Lock Gate/House
    if ((_isHouse or _isLockableGate) && _isUnlocked && _isClosed) then {
        if (s_player_lockhouse < 0) then {
            s_player_lockhouse = player addAction [localize "STR_BLD_ACTIONS_LOCKGATE", "\z\addons\dayz_code\actions\player_operate.sqf",[_cursorTarget,"Lock"], 1, true, true];
        };
    } else {
        player removeAction s_player_lockhouse;
        s_player_lockhouse = -1;
    };
    //Break In
    if ((_isHouse or _isLockableGate) && (_ownerPID != _uid) && !_isUnlocked) then {
        if (s_player_breakinhouse < 0) then {
            s_player_breakinhouse = player addAction [localize "STR_BLD_ACTIONS_BREAKIN", "\z\addons\dayz_code\actions\player_breakin.sqf",_cursorTarget, 1, true, true];
        };
    } else {
        player removeAction s_player_breakinhouse;
        s_player_breakinhouse = -1;
    };*/
    
    // garage
    if (_typeOfCursorTarget in DZE_Garage && {speed player <= 1}) then {
        _hasAccess = [player, _cursorTarget] call FNC_check_access;
        _allowed = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4));
        if ((s_player_garage < 0) && (_allowed or (_hasAccess select 1))) then {
            s_player_garage =  player addAction ["<t color='#FFAA00'>Garage Menu</t>", "custom\Garage\player_virtualgarage.sqf", _cursorTarget, 2, false];
        } else {
            s_player_garage = player addAction ["<t color='#FF0000'>Garage Locked</t>", "",_cursorTarget, 2, true, true, "", ""];   
        };
    } else {
        player removeAction s_player_garage;
        s_player_garage = -1;       
    };
    
    
    if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {speed player <= 1}) then {
        _hasAccess = [player, _cursorTarget] call FNC_check_access;
        _allowed = ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4));
        if (DZE_permanentPlot) then {
            if (s_player_plotManagement < 0 && _allowed) then {
                s_player_plotManagement = player addAction [format["<t color='#0059FF'>%1</t>",localize "STR_EPOCH_ACTIONS_MANAGEPLOT"], "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false];
            };
        } else {
            if (s_player_maintain_area < 0) then {
                s_player_maintain_area = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];
                s_player_maintain_area_force = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_FORCE_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "force", 5, false];
                s_player_maintain_area_preview = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];
            };
        };
        if (s_player_plot_boundary < 0 && (_allowed or (_hasAccess select 1))) then {
            s_player_plot_boundary = player addAction [localize "STR_EPOCH_PLOTMANAGEMENT_SHOW_BOUNDARY", "\z\addons\dayz_code\actions\plotManagement\plotToggleMarkers.sqf", "", 1, false];
        };
        if (DZE_permanentPlot && DZE_PlotOwnership) then {
            if (s_player_plot_take_ownership < 0 && (_hasAccess select 0)) then {
                s_player_plot_take_ownership = player addAction [localize "STR_EPOCH_APLOTFORLIFE_TAKE_PLOT_OWNERSHIP", "\z\addons\dayz_code\actions\plot_take_ownership.sqf", "", 1, false];
            };
        };
    } else {
        player removeAction s_player_plotManagement;
        s_player_plotManagement = -1;
        player removeAction s_player_maintain_area;
        s_player_maintain_area = -1;
        player removeAction s_player_maintain_area_force;
        s_player_maintain_area_force = -1;
        player removeAction s_player_maintain_area_preview;
        s_player_maintain_area_preview = -1;
        player removeAction s_player_plot_boundary;
        s_player_plot_boundary = -1;
        player removeAction s_player_plot_take_ownership;
        s_player_plot_take_ownership = -1;
    };
    
    if (DZE_HeliLift) then {
        _liftHeli = objNull;
        _found = false;    
        _allowTow = false;
        if ((count (crew _cursorTarget)) == 0) then {
            {
                if (!_allowTow) then {
                    _allowTow = _cursorTarget isKindOf _x;
                };
            } count DZE_HeliAllowToTow;
        };

        if (_allowTow) then {
            {
                if (!_found) then {
                    _posL = [_x] call FNC_getPos;
                    _posC = [_cursorTarget] call FNC_getPos;
                    _height = (_posL select 2) - (_posC select 2);
                    _hasAttached = _x getVariable["hasAttached",false];
                    if ((_height < 15) && {_height > 5} && {typeName _hasAttached != "OBJECT"}) then {
                        if (((abs((_posL select 0) - (_posC select 0))) < 10) && {(abs((_posL select 1) - (_posC select 1))) < 10}) then {
                            _liftHeli = _x;
                            _found = true;
                        };
                    };
                };
            } count (player nearEntities [DZE_HeliAllowTowFrom,15]);
        };

        _attached = _cursorTarget getVariable["attached",false];
        if (_found && {_allowTow} && {!locked _cursorTarget} && {!_isPZombie} && {typeName _attached != "OBJECT"}) then {
            if (s_player_heli_lift < 0) then {
                s_player_heli_lift = player addAction [localize "STR_EPOCH_ACTIONS_ATTACHTOHELI", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true];
            };
        } else {
            player removeAction s_player_heli_lift;
            s_player_heli_lift = -1;
        };
    };
    
    // Allow Owner to lock and unlock vehicle  
    if (_player_lockUnlock_crtl) then {
        if (s_player_lockUnlock_crtl < 0) then {
            _totalKeys = call epoch_tempKeys;
            _temp_keys = _totalKeys select 0;
            _temp_keys_names = _totalKeys select 1;
            _hasKey = _characterID in _temp_keys;
            _oldOwner = (_characterID == _uid);
            if (locked _cursorTarget) then {
                if (_hasKey || _oldOwner) then {
                    _unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true];
                    s_player_lockunlock set [count s_player_lockunlock,_unlock];
                    s_player_lockUnlock_crtl = 1;
                } else {
                    if (_hasHotwireKit) then {
                        _unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true];
                    } else {
                        _unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, false, true];
                    };
                    s_player_lockunlock set [count s_player_lockunlock,_unlock];
                    s_player_lockUnlock_crtl = 1;
                };
            } else {
                if (_hasKey || _oldOwner) then {
                    _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true];
                    s_player_lockunlock set [count s_player_lockunlock,_lock];
                    s_player_lockUnlock_crtl = 1;
                };
            };
        };     
    } else {
        {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
        s_player_lockUnlock_crtl = -1;
    };
    
    // gear access on surrendered player
    if (isPlayer _cursorTarget && {_isAlive} && {_cursorTarget getVariable ["DZE_Surrendered",false]}) then {
        if (s_player_SurrenderedGear < 0) then {
            s_player_SurrenderedGear = player addAction [localize "STR_UI_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true];
        };
    } else {
        player removeAction s_player_SurrenderedGear;
        s_player_SurrenderedGear = -1;
    };

    // Allow manage door
    if (DZE_doorManagement && (_typeOfCursorTarget in DZE_DoorsLocked)) then {
        // Check player access
        _hasAccess = [player, _cursorTarget] call FNC_check_access;
        if (s_player_manageDoor < 0 && ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3) or (_hasAccess select 4) or (_hasAccess select 5) or (_hasAccess select 6))) then {
            s_player_manageDoor = player addAction [format["<t color='#0059FF'>%1</t>", localize "STR_EPOCH_ACTIONS_MANAGEDOOR"], "\z\addons\dayz_code\actions\doorManagement\initDoorManagement.sqf", _cursorTarget, 5, false];
        };
    } else {
        player removeAction s_player_manageDoor;
        s_player_manageDoor = -1;
    };

    //Allow owner to unlock vault
    if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then {
        if (s_player_unlockvault < 0) then {
            if (_typeOfCursorTarget in DZE_LockedStorage) then {
                if (_characterID == dayz_combination || _ownerID == _uid) then {
                    _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true];
                    s_player_combi set [count s_player_combi,_combi];
                } else {
                    _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true];
                    s_player_combi set [count s_player_combi,_combi];
                };
                s_player_unlockvault = 1;
            } else {
                if (_characterID != dayz_combination && _ownerID != _uid) then {
                    _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true];
                    s_player_combi set [count s_player_combi,_combi];
                    s_player_unlockvault = 1;
                };
            };
        };
    } else {
        {player removeAction _x} count s_player_combi;s_player_combi = [];
        s_player_unlockvault = -1;
    };

    //Allow owner to pack vault
    if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3}  && {!keypadCancel}) then {
        if (s_player_lockvault < 0) then {
            if (_characterID == dayz_combination || _ownerID == _uid) then {
                s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true];
            };
        };
        if (s_player_packvault < 0 && (_characterID == dayz_combination || _ownerID == _uid)) then {
            s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true];
        };
    } else {
        player removeAction s_player_packvault;
        s_player_packvault = -1;
        player removeAction s_player_lockvault;
        s_player_lockvault = -1;
    };

    //Player Deaths
    if (_typeOfCursorTarget == "Info_Board_EP1") then {
        if (s_player_information < 0) then {
            s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true];
        };
    } else {
        player removeAction s_player_information;
        s_player_information = -1;
    };
    
    //Fuel Pump
    if (_typeOfCursorTarget in dayz_fuelpumparray) then {
        if (s_player_fuelauto < 0) then {        
            // check if Generator_DZ is running within 30 meters
            _findNearestGen = [];
            {
                if ((alive _x) && (_x getVariable ["GeneratorRunning", false])) then {
                    _findNearestGen set [count _findNearestGen,_x];
                };
            } count (nearestObjects [([player] call FNC_getPos), ["Generator_DZ"], 30]);
            
            // show that pump needs power if no generator nearby.
            if ((count _findNearestGen) > 0) then {
                s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true];
            } else {
                s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true];
            };
        };
    } else {
        player removeAction s_player_fuelauto;
        s_player_fuelauto = -1;
    };

    //Fuel Pump on truck
    if (_typeOfCursorTarget in DZE_fueltruckarray && _isAlive) then {
        if (s_player_fuelauto2 < 0) then {
            // show that fuel truck pump needs power.
            if (isEngineOn _cursorTarget) then {
                s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true];
            } else {
                s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true];
            };
        };
    } else {
        player removeAction s_player_fuelauto2;
        s_player_fuelauto2 = -1;
    };

    // inplace upgrade tool
    if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
        if ((s_player_lastTarget select 0) != _cursorTarget) then {
            if (s_player_upgrade_build > 0) then {
                player removeAction s_player_upgrade_build;
                s_player_upgrade_build = -1;
            };
        };
        if (s_player_upgrade_build < 0) then {
            _hasAccess = [player, _cursorTarget] call FNC_check_access;
            _upgrade = getArray (configFile >> "CfgVehicles" >> (typeOf _cursorTarget) >> "upgradeBuilding");
            if (((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) && (count _upgrade) > 0) then {
                s_player_lastTarget set [0,_cursorTarget];
                s_player_upgrade_build = player addAction [format[localize "str_upgrade",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true];
            };
        };
    } else {
        player removeAction s_player_upgrade_build;
        s_player_upgrade_build = -1;
    };
    
    // downgrade system
    if ((DZE_Lock_Door == _characterID)  && {!keypadCancel} && {_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base"}) then {
        if ((s_player_lastTarget select 1) != _cursorTarget) then {
            if (s_player_downgrade_build > 0) then {    
                player removeAction s_player_downgrade_build;
                s_player_downgrade_build = -1;
            };
        };
        if (s_player_downgrade_build < 0) then {
            _hasAccess = [player, _cursorTarget] call FNC_check_access;
            if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
                s_player_lastTarget set [1,_cursorTarget];
                s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true];
            };
        };
    } else {
        player removeAction s_player_downgrade_build;
        s_player_downgrade_build = -1;
    };

    // inplace maintenance tool
    if ((damage _cursorTarget >= DZE_DamageBeforeMaint) && {_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ"}) then {
        if ((s_player_lastTarget select 2) != _cursorTarget) then {
            if (s_player_maint_build > 0) then {
                player removeAction s_player_maint_build;
                s_player_maint_build = -1;
            };
        };
        if (s_player_maint_build < 0) then {
            _hasAccess = [player, _cursorTarget] call FNC_check_access;
            if ((_hasAccess select 0) or (_hasAccess select 2) or (_hasAccess select 3)) then {
                _text2 = _text + " (" + str(round ((damage _cursorTarget) * 100)) + "% damaged)";
                s_player_lastTarget set [2,_cursorTarget];
                s_player_maint_build = player addAction [format["%1 %2",localize "STR_EPOCH_ACTIONS_MAINTAIN",_text2], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true];
            };
        };
    } else {
        player removeAction s_player_maint_build;
        s_player_maint_build = -1;
    };

    //Start Generator
    if (_isGenerator) then {
        if (s_player_fillgen < 0) then {    
            // check if not running 
            if (_cursorTarget getVariable ["GeneratorRunning", false]) then {
                s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true];                
            } else {
                // check if not filled and player has jerry.
                if (_cursorTarget getVariable ["GeneratorFilled", false]) then {
                    s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true];
                } else {
                    if (_hasFuel20 or _hasFuel5 or _hasBarrel) then {
                        s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true];
                    };
                };
            };
        };
    } else {
        player removeAction s_player_fillgen;
        s_player_fillgen = -1;
    };

    //Towing with tow truck
    /*
    if(_typeOfCursorTarget == "TOW_DZE") then {
        if (s_player_towing < 0) then {
            if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
                s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true];                
            } else {
                s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true];                
            };
        };
    } else {
        player removeAction s_player_towing;
        s_player_towing = -1;
    };
    */

    // All Traders
    if (_isMan && {!(isPlayer _cursorTarget)} && {_typeOfCursorTarget in serverTraders} && {!_isPZombie}) then {
        if (s_player_parts_crtl < 0) then {
            _humanity = player getVariable ["humanity",0];
            _traderMenu = call compile format["menu_%1;",_typeOfCursorTarget];        
            _low_high = localize "STR_EPOCH_ACTIONS_HUMANITY_LOW";
            _humanity_logic = false;
            if ((_traderMenu select 2) == "friendly") then {
                _humanity_logic = (_humanity < -5000);
            };
            if ((_traderMenu select 2) == "hostile") then {
                _low_high = localize "STR_EPOCH_ACTIONS_HUMANITY_HIGH";
                _humanity_logic = (_humanity > -5000);
            };
            if ((_traderMenu select 2) == "hero") then {
                _humanity_logic = (_humanity < 5000);
            };
            if (_humanity_logic) then {
                _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false];
                s_player_parts set [count s_player_parts,_cancel];
            } else {
                // Static Menu
                {
                    _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true];
                    s_player_parts set [count s_player_parts,_buy];        
                } count (_traderMenu select 1);
                if (DZE_ConfigTrader) then {
                    _buyV = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false];
                    s_player_parts set [count s_player_parts,_buyV];
                } else {
                    // Database menu
                    _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false];
                    s_player_parts set [count s_player_parts,_buy];
                };
            };
            s_player_parts_crtl = 1;    
        };
    } else {
        {player removeAction _x} count s_player_parts;s_player_parts = [];
        s_player_parts_crtl = -1;
    };
    
    if (dayz_tameDogs) then {
        //Dog
        _hasRawMeat = {_x in Dayz_meatraw} count _magazinesPlayer > 0;
        if (_isDog && {_hasRawMeat} && {_isAlive} && {_ownerID == "0"} && {player getVariable ["dogID",0] == 0}) then {
            if (s_player_tamedog < 0) then {
                s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\dog\tame_dog.sqf", _cursorTarget, 1, false, true];
            };
        } else {
            player removeAction s_player_tamedog;
            s_player_tamedog = -1;
        };
        if (_isDog && {_ownerID == _id} && {_isAlive}) then {
            if (s_player_feeddog < 0 && _hasRawMeat) then {
                s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true];
            };
            if (s_player_waterdog < 0 && _hasbottleitem) then {
                s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true];
            };
            if (s_player_staydog < 0) then {
                if (_dogHandle getFSMVariable "_actionLieDown") then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
                s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true];
            };
            if (s_player_trackdog < 0) then {
                s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true];
            };
            if (s_player_barkdog < 0) then {
                s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true];
            };
            if (s_player_warndog < 0) then {
                _warn = _dogHandle getFSMVariable "_watchDog";
                if (_warn) then { _text = localize "str_epoch_player_247"; _warn = false; } else { _text = localize "str_epoch_player_248"; _warn = true; };
                s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true];        
            };
            if (s_player_followdog < 0) then {
                s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true];
            };
        } else {
            player removeAction s_player_feeddog;
            s_player_feeddog = -1;
            player removeAction s_player_waterdog;
            s_player_waterdog = -1;
            player removeAction s_player_staydog;
            s_player_staydog = -1;
            player removeAction s_player_trackdog;
            s_player_trackdog = -1;
            player removeAction s_player_barkdog;
            s_player_barkdog = -1;
            player removeAction s_player_warndog;
            s_player_warndog = -1;
            player removeAction s_player_followdog;
            s_player_followdog = -1;
        };
    };
} else {
    //Engineering
    player removeAction s_player_plot_boundary;
    s_player_plot_boundary = -1;
    player removeAction s_player_plot_take_ownership;
    s_player_plot_take_ownership = -1;
    player removeAction s_player_plotManagement;
    s_player_plotManagement = -1;
    {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
    player removeAction s_player_repair_crtl;
    s_player_repair_crtl = -1;
    dayz_myCursorTarget = objNull;
    player removeAction s_player_flipveh;
    s_player_flipveh = -1;
    player removeAction s_player_sleep;
    s_player_sleep = -1;
    player removeAction s_player_deleteBuild;
    s_player_deleteBuild = -1;
    player removeAction s_player_cook;
    s_player_cook = -1;
    player removeAction s_player_boil;
    s_player_boil = -1;
    player removeAction s_player_fireout;
    s_player_fireout = -1;
    player removeAction s_player_packtent;
    s_player_packtent = -1;
    player removeAction s_player_packtentinfected;
    s_player_packtentinfected = -1;
    player removeAction s_player_fillfuel;
    s_player_fillfuel = -1;
    //fuel
    
    // garage
    player removeAction s_player_garage;
    s_player_garage = -1;
    
    player removeAction s_player_fillfuel210;
    s_player_fillfuel210 = -1;
    player removeAction s_player_fillfuel20;
    s_player_fillfuel20 = -1;
    player removeAction s_player_fillfuel5;
    s_player_fillfuel5 = -1;
    //Allow player to siphon vehicle fuel
    player removeAction s_player_siphonfuel;
    s_player_siphonfuel = -1;
    //Allow player to gather
    player removeAction s_player_gather;
    s_player_gather = -1;
    player removeAction s_player_destorytent;
    s_player_destorytent = -1;
    // player removeAction s_player_attach_bomb;
    //  s_player_attach_bomb = -1;
    //debug
    //player removeAction s_player_debugCheck;
    //s_player_debugCheck = -1;
    player removeAction s_player_upgradestorage;
    s_player_upgradestorage = -1;
    /* //Unlock,Lock // Vanilla base building currently not used in Epoch
    player removeAction s_player_setCode;
    s_player_setCode = -1;
    player removeAction s_player_lockhouse;
    s_player_lockhouse = -1;
    player removeAction s_player_unlockhouse;
    s_player_unlockhouse = -1;
    player removeAction s_player_openGate;
    s_player_openGate = -1;
    player removeAction s_player_CloseGate;
    s_player_CloseGate = -1;
    player removeAction s_player_breakinhouse;
    s_player_breakinhouse = -1;
    player removeAction s_player_BuildUnLock;
    s_player_BuildUnLock = -1;
    player removeAction s_player_BuildLock;
    s_player_BuildLock = -1;*/
    {player removeAction _x} count s_player_combi;s_player_combi = [];    
    s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
    {player removeAction _x} count s_player_parts;s_player_parts = [];
    s_player_parts_crtl = -1;
    {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
    s_player_lockUnlock_crtl = -1;
    player removeAction s_player_SurrenderedGear;
    s_player_SurrenderedGear = -1;
    player removeAction s_player_maintain_area;
    s_player_maintain_area = -1;
    player removeAction s_player_maintain_area_force;
    s_player_maintain_area_force = -1;
    player removeAction s_player_maintain_area_preview;
    s_player_maintain_area_preview = -1;    
    player removeAction s_player_tamedog;
    s_player_tamedog = -1;
    player removeAction s_player_feeddog;
    s_player_feeddog = -1;
    player removeAction s_player_waterdog;
    s_player_waterdog = -1;
    player removeAction s_player_staydog;
    s_player_staydog = -1;
    player removeAction s_player_trackdog;
    s_player_trackdog = -1;
    player removeAction s_player_barkdog;
    s_player_barkdog = -1;
    player removeAction s_player_warndog;
    s_player_warndog = -1;
    player removeAction s_player_followdog;
    s_player_followdog = -1;
    player removeAction s_player_unlockvault;
    s_player_unlockvault = -1;
    player removeAction s_player_packvault;
    s_player_packvault = -1;
    player removeAction s_player_lockvault;
    s_player_lockvault = -1;
    player removeAction s_player_information;
    s_player_information = -1;
    player removeAction s_player_fillgen;
    s_player_fillgen = -1;
    player removeAction s_player_upgrade_build;
    s_player_upgrade_build = -1;
    player removeAction s_player_maint_build;
    s_player_maint_build = -1;
    player removeAction s_player_downgrade_build;
    s_player_downgrade_build = -1;
    player removeAction s_player_towing;
    s_player_towing = -1;
    player removeAction s_player_fuelauto;
    s_player_fuelauto = -1;
    player removeAction s_player_fuelauto2;
    s_player_fuelauto2 = -1;
    player removeAction s_player_manageDoor;
    s_player_manageDoor = -1;
};

//Dog actions on player self
if (_dogHandle > 0) then {
    _dog = _dogHandle getFSMVariable "_dog";
    if (isNil "_dog") exitWith {};
    if (isNil "_ownerID") then {_ownerID = "0"};
    if (_canDo && !_inVehicle && alive _dog && !(_ownerID in [dayz_characterID,_uid])) then {
        if (s_player_movedog < 0) then {
            s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID",0], 1, false, true];
        };
        if (s_player_speeddog < 0) then {
            _text = localize "str_epoch_player_249";
            _speed = 0;
            if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = localize "str_epoch_player_250"; };
            s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID",0],_speed], 0, false, true];
        };
        if (s_player_calldog < 0) then {
            s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID",0], true], 2, false, true];
        };
    };
} else {
    player removeAction s_player_movedog;        
    s_player_movedog = -1;
    player removeAction s_player_speeddog;
    s_player_speeddog = -1;
    player removeAction s_player_calldog;
    s_player_calldog = -1;
};

//Monitor
player setVariable ["selfActions", diag_ticktime, false];


 



Now i can confirm that it is perfectly saving vehicles in the database (in the garage) just fine and pulling them back out just fine and sticking on restarts. 
Here lies the problem when you click manage and add yourself to the garage list it is not saving in the database 
I think i know where this error is but i cant seem to figure out what is wrong with the snippet of code i modified to attempt to get this working

Below is line 135 that i modified for this in server updateobject


_object_damage = {
    //Allow dmg process
    private ["_hitpoints","_array","_hit","_selection","_key","_damage","_allFixed"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            _damage = damage _object;
            _array = _object getVariable ["GarageFriends",[]];
    } else {
    
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    _allFixed = true;
    
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _allFixed = false;
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit]; 
        } else {
            _array set [count _array,[_selection,0]]; 
        };
        } forEach _hitpoints;
    };
    if (_allFixed && !_totalDmg) then {_object setDamage 0;};
    
    if (_forced) then {        
        if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
        _recorddmg = true;           
    } else {
        //Prevent damage events for the first 10 seconds of the servers live.
        if (diag_ticktime - _lastUpdate > 10) then {
            if !(_object in needUpdate_objects) then {
                //diag_log format["DEBUG: Monitoring: %1",_object];
                needUpdate_objects set [count needUpdate_objects, _object];
                _recorddmg = true;
            };
        };
    };
    



Any help would be greatly appreciated thanks guys

Link to comment
Share on other sites

Recommended Posts

  • 0
15 minutes ago, BigEgg said:

Okay - try this:

 

In your player_deploy.sqf:

Find (around line 616)


PVDZ_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position],(_index call getDeployableClass)];
publicVariableServer "PVDZ_obj_Publish";

Replace it with:


private["_playerUID", "_OwnerUID"];
_playerUID = [player] call FNC_GetPlayerUID;
_OwnerUID = _playerUID;
_tmpbuilt setVariable["ownerPUID", _OwnerUID, true];
PVDZ_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position,_playerUID],(_index call getDeployableClass)];
publicVariableServer "PVDZ_obj_Publish";

 

Let me know how that works.

Sadly, it still remains exactly the same. still just poping up garage locked after deploying the garbage container

Link to comment
Share on other sites

  • 0
22 minutes ago, Th3-Hunter333 said:

Sadly, it still remains exactly the same. still just poping up garage locked after deploying the garbage container

Replace that code block with this instead:

if (_tmpbuilt isKindOf "Garbage_container") then {
	_tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
	PVDZ_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position,dayz_playerUID],(_index call getDeployableClass)];
	publicVariableServer "PVDZ_obj_Publish";
} else {
	PVDZ_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position],(_index call getDeployableClass)];
	publicVariableServer "PVDZ_obj_Publish";
};

Place another container and tell me what it does.

Link to comment
Share on other sites

  • 0
22 minutes ago, BigEgg said:

Replace that code block with this instead:


if (_tmpbuilt isKindOf "Garbage_container") then {
	_tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
	PVDZ_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position,dayz_playerUID],(_index call getDeployableClass)];
	publicVariableServer "PVDZ_obj_Publish";
} else {
	PVDZ_obj_Publish = [call fnc_perm_deployable_id,_tmpbuilt,[_dir,_position],(_index call getDeployableClass)];
	publicVariableServer "PVDZ_obj_Publish";
};

Place another container and tell me what it does.

Its getting very close now, garage menu is working as of now and an able to access garage menu and add yourself to it but that is not saving in the database.

Its not saving vehicles or anyone you add to the garage menu in the database so after server restart everything is gone except the garage (which you can still access and readd yourself)

This error might be in server update object right?

line 71 is object inventory and line 129 is object damage where i have edited in both calls for DZE_garage

 

// [_object,_type] spawn server_updateObject;
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
if (isNil "sm_done") exitWith {};
private ["_objectID","_objectUID","_object_position","_isNotOk","_object","_type","_recorddmg","_forced","_lastUpdate","_needUpdate","_object_inventory","_object_damage","_objWallDamage","_object_killed","_object_maintenance","_object_variables","_totalDmg","_garagelist"];
_object = _this select 0;

// garage
if ((typeOf _object) in DZE_Garage) then {_garagelist = _this select 2;};

_type = _this select 1;
_recorddmg = false;
_isNotOk = false;
_forced = if (count _this > 2) then {_this select 2} else {false};
_totalDmg = if (count _this > 3) then {_this select 3} else {false};
_objectID = "0";
_objectUID = "0";

if ((isNil "_object") || {isNull _object}) exitWith {diag_log "server_updateObject.sqf _object null or nil, could not update object"};
_objectID = _object getVariable ["ObjectID","0"];
_objectUID = _object getVariable ["ObjectUID","0"];


if ((typeName _objectID == "SCALAR") || (typeName _objectUID == "SCALAR")) then { 
    #ifdef OBJECT_DEBUG
        diag_log (format["Non-string Object: ID %1 UID %2", _objectID, _objectUID]);
    #endif
    //force fail
    _objectID = nil;
    _objectUID = nil;
};

if (!((typeOf _object) in DZE_safeVehicle) && !locked _object) then {
    //diag_log format["Object: %1, ObjectID: %2, ObjectUID: %3",_object,_objectID,_objectUID];
    if (!(_objectID in dayz_serverIDMonitor) && isNil {_objectUID}) then { 
        //force fail
        _objectID = nil;
        _objectUID = nil;        
    };
    if ((isNil {_objectID}) && (isNil {_objectUID})) then {
        _object_position = getPosATL _object;
        #ifdef OBJECT_DEBUG
            diag_log format["Object %1 with invalid ID at pos %2",typeOf _object,_object_position];
        #endif
        _isNotOk = true;
    };
};

if (_isNotOk) exitWith {
    //deleteVehicle _object;
};

_lastUpdate = _object getVariable ["lastUpdate",diag_tickTime];
_needUpdate = _object in needUpdate_objects;

// TODO ----------------------
_object_position = {
    private ["_position","_worldspace","_fuel","_key"];
    _position = getPosATL _object;
    //_worldspace = [round (direction _object),_position];
    _worldspace = [getDir _object, _position] call AN_fnc_formatWorldspace; // Precise Base Building 1.0.5
    _fuel = if (_object isKindOf "AllVehicles") then {fuel _object} else {0};
    
    _key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
    _key call server_hiveWrite;    

    #ifdef OBJECT_DEBUG
        diag_log ("HIVE: WRITE: "+ str(_key));
    #endif
};

_object_inventory = {
    private ["_inventory","_key","_isNormal","_coins"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            if (isNil "_garagelist") then {
                _garagelist = _object getVariable ["StoredVehicles",[]];
            };
            if (_objectID == "0") then {
                _key = format["CHILD:309:%1:%2:",_uid,_garagelist];
            } else {
                _key = format["CHILD:303:%1:%2:",_objectID,_garagelist];
            };
            _key call server_hiveWrite;
        } else {
    if (_object isKindOf "TrapItems") then {
        _inventory = [["armed",_object getVariable ["armed",false]]];
    } else {
        _isNormal = true;
    };
        
        
        if (DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ")) then {
            _isNormal = false;
            _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked)) then {
            _isNormal = false;
            _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (_isNormal) then {
            _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object];
        };
    };
    
    _previous = str(_object getVariable["lastInventory",[]]);
    if (str _inventory != _previous) then {
        _object setVariable["lastInventory",_inventory];
        if (_objectID == "0") then {
            _key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
        } else {
            _key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
        };
        if (Z_SingleCurrency) then {
            _coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
            _key = _key + str _coins + ":";
        };
        
        #ifdef OBJECT_DEBUG
            diag_log ("HIVE: WRITE: "+ str(_key));
        #endif
        
        _key call server_hiveWrite;
    };
};

_object_damage = {
    //Allow dmg process
    private ["_hitpoints","_array","_hit","_selection","_key","_damage","_allFixed"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            _damage = damage _object;
            _array = _object getVariable ["GarageFriends",[]];
            _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
            _key call server_hiveWrite;
    } else {
    
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    _allFixed = true;
    
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _allFixed = false;
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit]; 
        } else {
            _array set [count _array,[_selection,0]]; 
        };
        } forEach _hitpoints;
    };
    if (_allFixed && !_totalDmg) then {_object setDamage 0;};
    
    if (_forced) then {        
        if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
        _recorddmg = true;           
    } else {
        //Prevent damage events for the first 10 seconds of the servers live.
        if (diag_ticktime - _lastUpdate > 10) then {
            if !(_object in needUpdate_objects) then {
                //diag_log format["DEBUG: Monitoring: %1",_object];
                needUpdate_objects set [count needUpdate_objects, _object];
                _recorddmg = true;
            };
        };

    
    if (_recorddmg) then {
        if (_objectID == "0") then {
            _key = format["CHILD:306:%1:",_objectUID] + str _array + ":" + str _damage + ":";
        } else {
            _key = format["CHILD:306:%1:",_objectID] + str _array + ":" + str _damage + ":";
        };
        
        diag_log ("HIVE: WRITE: "+ str(_key));
        _key call server_hiveWrite;   
    };
};
};
//Walls
_objWallDamage = {
    private ["_key","_damage"];
    _damage = (damage _object);

    if (_objectID == "0") then {
        _key = format["CHILD:306:%1:%2:%3:",_objectUID,[],_damage];
    } else {
        _key = format["CHILD:306:%1:%2:%3:",_objectID,[],_damage];
    };
    
    diag_log ("HIVE: WRITE: "+ str(_key));
    
    _key call server_hiveWrite;
};

_object_killed = {
    private "_key";
    _object setDamage 1;
    
    if (_objectID == "0") then {
        //Need to update hive to make a new call to allow UID to be updated for a killed event
        //_key = format["CHILD:306:%1:%2:%3:",_objectUID,[],1];
        _key = format["CHILD:310:%1:",_objectUID];
    } else {
        _key = format["CHILD:306:%1:%2:%3:",_objectID,[],1];
    };
    _key call server_hiveWrite;
    
    diag_log format["DELETE: Deleted by KEY: %1",_key];
    
    if (((typeOf _object) in DayZ_removableObjects) or ((typeOf _object) in DZE_isRemovable)) then {[_objectID,_objectUID] call server_deleteObj;};
};

_object_maintenance = {
    private ["_ownerArray","_key"];

    _ownerArray = _object getVariable ["ownerArray",[]];
    _accessArray = _object getVariable ["dayz_padlockCombination",[]];
    _variables set [count _variables, ["ownerArray", _ownerArray]];
    _variables set [count _variables, ["padlockCombination", _accessArray]];

    if (_objectID == "0") then {
        //_key = format["CHILD:309:%1:%2:",_objectUID,_ownerArray];
        _key = format["CHILD:306:%1:%2:%3:",_objectUID,[],0]; //Wont work just now.
    } else {
        //_key = format["CHILD:303:%1:%2:",_objectID,_ownerArray];
        _key = format["CHILD:306:%1:%2:%3:",_objectID,[],0];
    };

//    #ifdef OBJECT_DEBUG
        diag_log ("HIVE: WRITE: Maintenance, "+ str(_key));
//    #endif
    _key call server_hiveWrite;
};

_object_variables = {
    private ["_ownerArray","_key","_accessArray","_variables","_coins"];

    _ownerArray = _object getVariable ["ownerArray",[]];
    _accessArray = _object getVariable ["dayz_padlockCombination",[]];
    _lockedArray = _object getVariable ["BuildLock",false];
    
    //diag_log format ["[%1,%2]",_ownerArray,_accessArray];
    _variables = [];
    _variables set [count _variables, ["ownerArray", _ownerArray]];
    _variables set [count _variables, ["padlockCombination", _accessArray]];
    _variables set [count _variables, ["BuildLock", _lockedArray]];

    if (_objectID == "0") then {
        _key = format["CHILD:309:%1:%2:",_objectUID,_variables];
    } else {
        _key = format["CHILD:303:%1:%2:",_objectID,_variables];
    };
    if (Z_SingleCurrency) then {
        _coins = _object getVariable [Z_MoneyVariable, -1];
        _key = _key + str _coins + ":";
    };
    _key call server_hiveWrite;
};

_object setVariable ["lastUpdate",diag_ticktime,true];
switch (_type) do {
    case "all": {
        call _object_position;
        call _object_inventory;
        call _object_damage;
    };
    case "position": {
        call _object_position;
    };
    case "gear": {
        call _object_inventory;
    };
    case "maintenance": {
        call _object_maintenance;
    };
    case "damage"; case "repair" : {
        call _object_damage;
    };
    case "killed": {
        call _object_killed;
    };
    case "accessCode"; case "buildLock" : {
        call _object_variables;
    };
    case "objWallDamage": {
        call _objWallDamage;
    };
};

[spoiler/]
 

Link to comment
Share on other sites

  • 0

@Th3-Hunter333  i use it to craft the garage and test the scroll.

 

craftgarage.sqf

Spoiler


// If an array was passed redirect to vanilla player_build (Epoch items pass a string)


private ["_playerPos","_nearRestr","_hastool","_hasitem","_removed","_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"];

//Check if building already in progress, exit if so.
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
dayz_actionInProgress = true;

_pos = [player] call FNC_GetPos;

_onLadder =	(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

_inventory = items player;
_hastool =     "ItemToolbox" in _inventory;


_playerPos = getPosATL player;
_nearRestr = count nearestObjects [_playerPos, ["Plastic_Pole_EP1_DZ"], 45] > 0;
_nearRestr2 = count nearestObjects [_playerPos, ["Garbage_container"], 145] > 0;
 

if !(_nearRestr) exitWith {
cutText [format["You cannot build  out of a plot area"], "PLAIN DOWN"];  
    dayz_actionInProgress = false;
    };

if (_nearRestr2) exitWith {
cutText [format["You cannot build another Garage  in this area 145mts"], "PLAIN DOWN"];  
    dayz_actionInProgress = false;
    };
	
if (!_hastool) exitWith {cutText
[format["Needs a Toolbox"], "PLAIN DOWN"];
dayz_actionInProgress = false;
};

if (_hastool) then {

titleText ["Your gonna loose your backpack", "PLAIN DOWN"];titleFadeOut 5;


DZE_Q = false;
DZE_Z = false;

DZE_Q_alt = false;
DZE_Z_alt = false;

DZE_Q_ctrl = false;
DZE_Z_ctrl = false;

DZE_5 = false;
DZE_4 = false;
DZE_6 = false;

DZE_F = false;

DZE_cancelBuilding = false;

DZE_updateVec = false;
DZE_memDir = 0;
DZE_memForBack = 0;
DZE_memLeftRight = 0;

call gear_ui_init;
closeDialog 1;

if (dayz_isSwimming) exitWith {dayz_actionInProgress = false; localize "str_player_26" call dayz_rollingMessages;};
if (_inVehicle) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;};
if (_onLadder) exitWith {dayz_actionInProgress = false; localize "str_player_21" call dayz_rollingMessages;};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;};


_classname =  "Garbage_container";    
_classnametmp = _classname;
_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
	

	_lockable = 0; //default define if lockable not found in config file below
	if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then { //find out if item is lockable object
		_lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable"); // 2=lockbox, 3=combolock, 4=safe
	};

	_isAllowedUnderGround = 1; //check if allowed to build under terrain
	if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
		_isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
	};

_offset =     getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
if((count _offset) <= 0) then {
    _offset = [0,3,0];
};	

	_objectHelper = objNull;
	_isOk = true;
	_location1 = [player] call FNC_GetPos; // get inital players position
	_dir = getDir player; //required to pass direction when building

	// if ghost preview available use that instead
	if (_ghost != "") then {
		_classname = _ghost;
	};

	_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built

	

	_objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
	_helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
	_objectHelper setobjecttexture [0,_helperColor];
	_objectHelper attachTo [player,_offset];
	_object attachTo [_objectHelper,[0,0,0]];

	if (isClass (configFile >> "SnapBuilding" >> _classname)) then {	
		["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
	};

	
		["","","",["Init","Init",0]] spawn build_vectors;
	

	_objHDiff = 0;	
	_cancel = false;
	_reason = "";
	
	helperDetach = false;
	_canDo = (!r_drag_sqf and !r_player_unconscious);
	_position = [_objectHelper] call FNC_GetPos;

	while {_isOk} do {

		_zheightchanged = false;
		_zheightdirection = "";
		_rotate = false;

		if (DZE_Q) then {
			DZE_Q = false;
			_zheightdirection = "up";
			_zheightchanged = true;
		};
		if (DZE_Z) then {
			DZE_Z = false;
			_zheightdirection = "down";
			_zheightchanged = true;
		};
		if (DZE_Q_alt) then {
			DZE_Q_alt = false;
			_zheightdirection = "up_alt";
			_zheightchanged = true;
		};
		if (DZE_Z_alt) then {
			DZE_Z_alt = false;
			_zheightdirection = "down_alt";
			_zheightchanged = true;
		};
		if (DZE_Q_ctrl) then {
			DZE_Q_ctrl = false;
			_zheightdirection = "up_ctrl";
			_zheightchanged = true;
		};
		if (DZE_Z_ctrl) then {
			DZE_Z_ctrl = false;
			_zheightdirection = "down_ctrl";
			_zheightchanged = true;
		};
		if (DZE_4) then {
			_rotate = true;
			DZE_4 = false;
			if(DZE_dirWithDegrees) then{
				DZE_memDir = DZE_memDir - DZE_curDegree;
			}else{
				DZE_memDir = DZE_memDir - 45;
			};
		};
		if (DZE_6) then {
			_rotate = true;
			DZE_6 = false;
			if(DZE_dirWithDegrees) then{
				DZE_memDir = DZE_memDir + DZE_curDegree;
			}else{
				DZE_memDir = DZE_memDir + 45;
			};
		};
		
		if(DZE_updateVec) then{
			[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
			DZE_updateVec = false;
		};
		
		if (DZE_F and _canDo) then {
			if (helperDetach) then {
				_objectHelper attachTo [player];
				DZE_memDir = DZE_memDir-(getDir player);
				helperDetach = false;
				[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
			} else {		
				_objectHelperPos = getPosATL _objectHelper;
				detach _objectHelper;			
				DZE_memDir = getDir _objectHelper;
				[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
				_objectHelper setPosATL _objectHelperPos;
				_objectHelper setVelocity [0,0,0]; //fix sliding glitch
				helperDetach = true;
			};
			DZE_F = false;
		};

		if(_rotate) then {
			[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
		};

		if(_zheightchanged) then {
			if (!helperDetach) then {
			detach _objectHelper;
			_objectHelperDir = getDir _objectHelper;
			};

			_position = [_objectHelper] call FNC_GetPos;

			if(_zheightdirection == "up") then {
				_position set [2,((_position select 2)+0.1)];
				_objHDiff = _objHDiff + 0.1;
			};
			if(_zheightdirection == "down") then {
				_position set [2,((_position select 2)-0.1)];
				_objHDiff = _objHDiff - 0.1;
			};

			if(_zheightdirection == "up_alt") then {
				_position set [2,((_position select 2)+1)];
				_objHDiff = _objHDiff + 1;
			};
			if(_zheightdirection == "down_alt") then {
				_position set [2,((_position select 2)-1)];
				_objHDiff = _objHDiff - 1;
			};

			if(_zheightdirection == "up_ctrl") then {
				_position set [2,((_position select 2)+0.01)];
				_objHDiff = _objHDiff + 0.01;
			};
			if(_zheightdirection == "down_ctrl") then {
				_position set [2,((_position select 2)-0.01)];
				_objHDiff = _objHDiff - 0.01;
			};

			if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
				_position set [2,0];
			};

			if (surfaceIsWater _position) then {
				_objectHelper setPosASL _position;
			} else {
				_objectHelper setPosATL _position;
			};

			if (!helperDetach) then {
			_objectHelper attachTo [player];
			};
			[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
		};

		uiSleep 0.5;

		_location2 = [player] call FNC_GetPos;
		_objectHelperPos = [_objectHelper] call FNC_GetPos;
		
		if(DZE_5) exitWith {
			_isOk = false;
			_position = [_object] call FNC_GetPos;
			detach _object;
			_dir = getDir _object;
			_vector = [(vectorDir _object),(vectorUp _object)];	
			deleteVehicle _object;
			detach _objectHelper;
			deleteVehicle _objectHelper;
		};

		if(_location1 distance _location2 > DZE_buildMaxMoveDistance) exitWith {
			_isOk = false;
			_cancel = true;
			_reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
			detach _object;
			deleteVehicle _object;
			detach _objectHelper;
			deleteVehicle _objectHelper;
		};
		
		if(_location1 distance _objectHelperPos > DZE_buildMaxMoveDistance) exitWith {
			_isOk = false;
			_cancel = true;
			_reason = format[localize "STR_EPOCH_BUILD_FAIL_TOO_FAR",DZE_buildMaxMoveDistance];
			detach _object;
			deleteVehicle _object;
			detach _objectHelper;
			deleteVehicle _objectHelper;
		};

		if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
			_isOk = false;
			_cancel = true;
			_reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
			detach _object;
			deleteVehicle _object;
			detach _objectHelper;
			deleteVehicle _objectHelper;
		};

		if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {
			_isOk = false;
			_cancel = true;
			_reason = localize "str_epoch_player_43";
			detach _object;
			deleteVehicle _object;
			detach _objectHelper;
			deleteVehicle _objectHelper;
		};

		if (DZE_cancelBuilding) exitWith {
			_isOk = false;
			_cancel = true;
			_reason = localize "STR_EPOCH_PLAYER_46";
			detach _object;
			deleteVehicle _object;
			detach _objectHelper;
			deleteVehicle _objectHelper;
		};
	};
	
	_isOk = true;
	_proceed = false;
	_counter = 0;
	_location = [0,0,0];

	//No building on roads unless toggled
	if (!DZE_BuildOnRoads) then {
		if (isOnRoad _position) then { _cancel = true; _reason = localize "STR_EPOCH_BUILD_FAIL_ROAD"; };
	};

	// No building in trader zones
	if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };

	if(!_cancel) then {

		_classname = _classnametmp;

		// Start Build
		_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; //create actual object that will be published to database

		_tmpbuilt setdir _dir; //set direction inherited from passed args from control
		_tmpbuilt setVariable["memDir",_dir,true];

		// Get position based on object
		_location = _position;

		if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then { //check Z axis if not allowed to build underground
			_location set [2,0]; //reset Z axis to zero (above terrain)
		};
		
		_tmpbuilt setVectorDirAndUp _vector;
		
		_buildOffset = [0,0,0];
		_vUp = _vector select 1;
		switch (_classname) do {
			case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
		};
		
		_location = [
			(_location select 0) - (_buildOffset select 0),
			(_location select 1) - (_buildOffset select 1),
			(_location select 2) - (_buildOffset select 2)
		];
	
		if (surfaceIsWater _location) then {
			_tmpbuilt setPosASL _location;
			_location = ASLtoATL _location; //Database uses ATL
		} else {
			_tmpbuilt setPosATL _location;
		};

		format[localize "str_epoch_player_138",_text] call dayz_rollingMessages;

		//////////////////////////////////////////////////##########START TO BUILD AND REMOVE OBJETS
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;
  
    //cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
		
		_limit = 3; //times it takes to build by default

		if (DZE_StaticConstructionCount > 0) then { //if count is manually overridden inside init.sqf, use that instead, else use limits configured in config files
			_limit = DZE_StaticConstructionCount;
		}
		else {
			if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
				_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
			};
		};


		
				

				_tmpbuilt setVariable ["OEMPos",_location,true]; //store original location as a variable

				 //if not lockable item
					
					_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
					
						if (DZE_permanentPlot) then {
							_tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
							
								_friendsArr = [[dayz_playerUID,toArray (name player)]];
								_tmpbuilt setVariable ["plotfriends", _friendsArr, true];
								PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,dayz_playerUID,_vector],_friendsArr];
								publicVariableServer "PVDZ_obj_Publish";
						cutText [format["Use the garage to store vehicles"], "PLAIN DOWN",3];	
					};
				
			} else { //if magazine was not removed, cancel publish
				deleteVehicle _tmpbuilt;
				localize "str_epoch_player_46" call dayz_rollingMessages;
			};

	};	

dayz_actionInProgress = false;

 

now if u wanna save the garge in the data base:

your custom variables.sqf

add the object here:

DayZ_SafeObjects = ["Garbage_container","the others default objects".........];

in server_monitor.sqf

find:

if( (count _inventory > 0) && !_isPlot && !_doorLocked) then {

replace with:

if( (count _inventory > 0) && !_isPlot && !_doorLocked && {_type != "Garbage_container"} ) then {

 

 

Now you need define how you wanna execute craftgarage.sqf by scroll menu or using deployanything or extra_rc.hpp.

 

 

 

Link to comment
Share on other sites

  • 0

 

if u gonna use scroll menu then you can use the cursor on plotpole to craft the garage. like plotmanagement.

if (DZE_permanentPlot && DZE_PlotOwnership) then {
			if (s_player_plot_take_ownership < 0 && (_hasAccess select 0)) then {
				s_player_plot_take_ownership = player addAction [localize "STR_EPOCH_APLOTFORLIFE_TAKE_PLOT_OWNERSHIP", "\z\addons\dayz_code\actions\plot_take_ownership.sqf", "", 1, false];
			};
		};
		//craft garage
		if (s_player_craftgarge < 0 && (_allowed or (_hasAccess select 1))) then {
		s_player_craftgarage = player addAction ["<t color='#66CCFF'>CRAFT-GARAGE</t>", "YOUR PATH\craftgarage.sqf", [], 5, false];
	    };
	} else {
		player removeAction s_player_plotManagement;
		s_player_plotManagement = -1;
		player removeAction s_player_maintain_area;
		s_player_maintain_area = -1;
		player removeAction s_player_maintain_area_force;
		s_player_maintain_area_force = -1;
		player removeAction s_player_maintain_area_preview;
		s_player_maintain_area_preview = -1;
		player removeAction s_player_plot_boundary;
		s_player_plot_boundary = -1;
		player removeAction s_player_plot_take_ownership;
		s_player_plot_take_ownership = -1;
		player removeAction s_player_craftgarage;//craftgarage
        s_player_craftgarage = -1;//craftgarage
	};

 

 

} else {
	//Engineering

bellow paste:

	///craftgarage
     player removeAction s_player_craftgarage;
     s_player_craftgarage = -1;
Link to comment
Share on other sites

  • 0
13 hours ago, juandayz said:

 

if u gonna use scroll menu then you can use the cursor on plotpole to craft the garage. like plotmanagement.


if (DZE_permanentPlot && DZE_PlotOwnership) then {
			if (s_player_plot_take_ownership < 0 && (_hasAccess select 0)) then {
				s_player_plot_take_ownership = player addAction [localize "STR_EPOCH_APLOTFORLIFE_TAKE_PLOT_OWNERSHIP", "\z\addons\dayz_code\actions\plot_take_ownership.sqf", "", 1, false];
			};
		};
		//craft garage
		if (s_player_craftgarge < 0 && (_allowed or (_hasAccess select 1))) then {
		s_player_craftgarage = player addAction ["<t color='#66CCFF'>CRAFT-GARAGE</t>", "YOUR PATH\craftgarage.sqf", [], 5, false];
	    };
	} else {
		player removeAction s_player_plotManagement;
		s_player_plotManagement = -1;
		player removeAction s_player_maintain_area;
		s_player_maintain_area = -1;
		player removeAction s_player_maintain_area_force;
		s_player_maintain_area_force = -1;
		player removeAction s_player_maintain_area_preview;
		s_player_maintain_area_preview = -1;
		player removeAction s_player_plot_boundary;
		s_player_plot_boundary = -1;
		player removeAction s_player_plot_take_ownership;
		s_player_plot_take_ownership = -1;
		player removeAction s_player_craftgarage;//craftgarage
        s_player_craftgarage = -1;//craftgarage
	};

 

 


} else {
	//Engineering

bellow paste:


	///craftgarage
     player removeAction s_player_craftgarage;
     s_player_craftgarage = -1;

So far so good that helped alot, currently it is now saving the garage correctly and saving the garage owner properly after restarts (in manage garage)
But now instead it is not saving vehicles that are stored in the database.

Followed by an zero divisor error (one i have never seen before)

Error parse number:zero divisor
line 15
_inv = _x select 4;
_fuel = _x...'
File mpmissions\__cur_mp.Chernarus\custom\Garage\garage_storedvehicles.sqf

This is also another file that i have not edited whatsoever and am not sure what could be possibly causing this one 

Clickactions that i have used to execute the virtual garage script you have given me

//  DZE_CLICK_ACTIONS
//      This is where you register your right-click actions
//  FORMAT -- (no comma after last array entry)
//      [_classname,_text,_execute,_condition],
//  PARAMETERS
//  _classname  : the name of the class to click on 
//                  (example = "ItemBloodbag")
//  _text       : the text for the option that is displayed when right clicking on the item 
//                  (example = "Self Transfuse")
//  _execute    : compiled code to execute when the option is selected 
//                  (example = "execVM 'my\scripts\self_transfuse.sqf';")
//  _condition  : compiled code evaluated to determine whether or not the option is displayed
//                  (example = {true})
//  EXAMPLE -- see below for some simple examples
DZE_CLICK_ACTIONS = [
    ["ItemToolbox","Virtual garage","execVM 'custom\garage\craftgarage.sqf';","true"],
    ["ItemToolbox","Toggle Map Marker","execVM 'custom\click_actions\marker.sqf';","true"],
    ["ItemGPS","Toggle Map Marker","execVM 'custom\click_actions\marker.sqf';","true"],
    ["ItemMap","Toggle Map Marker","execVM 'custom\click_actions\marker.sqf';","true"],
    ["ItemGPS","Locate Vehicle","execVM 'Custom\locatevic\locate_vehicle.sqf';","true"],
    ["ItemRadio","Switch ON/OFF","execVM 'Custom\remote\switch_on_off.sqf';","true"],
    ["ItemRadio","Doms Dev Help","execVM 'Custom\AS50.sqf';","true"],
        ["Binocular_Vector","Turn grass on Far" ,"setTerrainGrid 12.5; systemChat('Grass on');","true"],
        ["Binocular_Vector","Turn grass on Medium" ,"setTerrainGrid 25; systemChat('Grass on');","true"],
        ["Binocular_Vector","Turn grass off" ,"setTerrainGrid 50; systemChat('Grass off');","true"],
        ["Binocular_Vector","View Distance: 500m" ,"setViewDistance 500; systemChat('ViewDistance: 500');","true"],
        ["Binocular_Vector","View Distance: 1000m" ,"setViewDistance 1000; systemChat('ViewDistance: 1000');","true"],
        ["Binocular_Vector","View Distance: 1500m" ,"setViewDistance 1500; systemChat('ViewDistance: 1500');","true"],
        ["Binocular_Vector","View Distance: 2000m" ,"setViewDistance 2000; systemChat('ViewDistance: 2000'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular_Vector","View Distance: 2500m" ,"setViewDistance 2500; systemChat('ViewDistance: 2500'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular_Vector","View Distance: 3000m" ,"setViewDistance 3000; systemChat('ViewDistance: 3000'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular_Vector","View Distance: 3500m" ,"setViewDistance 3500; systemChat('ViewDistance: 3500'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular_Vector","View Distance: 4000m" ,"setViewDistance 4000; systemChat('ViewDistance: 4000'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular","Turn grass on" ,"setTerrainGrid 3.125; systemChat('Grass on');","true"],
        ["Binocular","Turn grass off" ,"setTerrainGrid 50; systemChat('Grass off');","true"],
        ["Binocular","View Distance: 500m" ,"setViewDistance 500; systemChat('ViewDistance: 500');","true"],
        ["Binocular","View Distance: 1000m" ,"setViewDistance 1000; systemChat('ViewDistance: 1000');","true"],
        ["Binocular","View Distance: 1500m" ,"setViewDistance 1500; systemChat('ViewDistance: 1500');","true"],
        ["Binocular","View Distance: 2000m" ,"setViewDistance 2000; systemChat('ViewDistance: 2000'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular","View Distance: 2500m" ,"setViewDistance 2500; systemChat('ViewDistance: 2500'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular","View Distance: 3000m" ,"setViewDistance 3000; systemChat('ViewDistance: 3000'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular","View Distance: 3500m" ,"setViewDistance 3500; systemChat('ViewDistance: 3500'); systemChat('Warning: Higher the view distance Lower the FPS');","true"],
        ["Binocular","View Distance: 4000m" ,"setViewDistance 4000; systemChat('ViewDistance: 4000'); systemChat('Warning: Higher the view distance Lower the FPS');","true"]
];

[spoiler/]

Honestly im not sure where to look for this one at all sadly

Link to comment
Share on other sites

  • 0

Ok just posting a minor update, it would appear that they are indeed saving in the database (while not appearing in the garage menu in game after a restart)

It seems to be only storing the vehicle in the database just fine but once server is restarted (the vehicle remains in the database but will not show up in the garage menu and therefore can not be pulled back out)

Very strange, very much indeed here.

Thank you guys dearly for all this help as well

Link to comment
Share on other sites

  • 0
6 minutes ago, juandayz said:

This garage uses an inventory to save vehicles? Like safes or tents? Cuz in the code that i give u (server monitor) i define the object garage as an object without inventory s

SAme as plots,doors..

I may not understand the question but the garage saves vehicles in the inventory slot in the database (which mind you works perfectly as you can see below. Player id is saving just fine as well as every vehicle shows up just fine in only the database)

Note:i hid the full id for my players sake since he has requested it but it does show his full id in the database just fine

[["7656************",[99,111,114,100]],["T90","893","0","0",[[[],[]],[[],[]],[[],[]]],1.0,0,[]],["ATV_US_EP1","5668","0","0",[[[],[]],[[],[]],[[],[]]],0.997,0,[]],["ArmoredSUV_PMC_DZE","10566","0","0",[[[],[]],[[],[]],[[],[]]],0.999,0,[]]]

 

When the server restarts i get the error that is described above from my last comment when accessing the garage (also the vehicle that was put into the garage is not showing up in the virtual garage in game which means it cant be spawned back again)

Meanwhile when checking the database the vehicle and player ids are still there just like above ^

Link to comment
Share on other sites

  • 0
On 12/28/2016 at 9:07 PM, juandayz said:

This garage uses an inventory to save vehicles? Like safes or tents? Cuz in the code that i give u (server monitor) i define the object garage as an object without inventory s

SAme as plots,doors..

Going to update on this again, im now getting errors related to the edits done to server update object
 

20:49:40 "VIRTUAL GARAGE: Player Inaccurate (7656************) has stored a Copcar | [["CYBP_Camel_us","5904","0","0",[[[],[]],[[],[]],[[],[]]],1,0,[]],["350z_ruben","7201","0","0",[[[],[]],[[],[]],[[],[]]],1,0,[]],["CSJ_GyroC","158","0","0",[[[],[]],[[],[]],[[],[]]],1,0,[]],["CYBP_Camel_us","5559","0","0",[[[],[]],[[],[]],[[],[]]],1,0,[]],["Copcar","1826","0","0",[[[],[]],[[],[]],[[],[]]],1,0,[]]]"
20:49:40 Error in expression <then {
_key = format["CHILD:309:%1:%2:",_uid,_garagelist];
} else {
_key = forma>
20:49:40   Error position: <_uid,_garagelist];
} else {
_key = forma>
20:49:40   Error Undefined variable in expression: _uid
20:49:40 File z\addons\dayz_server\compile\server_updateObject.sqf, line 80
20:49:40 Error in expression <tVariable["lastInventory",[]]);
if (str _inventory != _previous) then {
_object >
20:49:40   Error position: <_inventory != _previous) then {
_object >
20:49:40   Error Undefined variable in expression: _inventory
20:49:40 File z\addons\dayz_server\compile\server_updateObject.sqf, line 109

This is the server update object where the script errors out at

Also i can tell that _uid and _inventory is actually not defined from what i can tell (keep in mind im no script editor expert either)

_object_inventory = {
    private ["_inventory","_key","_isNormal","_coins"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            if (isNil "_garagelist") then {
                _garagelist = _object getVariable ["StoredVehicles",[]];
            };
            if (_objectID == "0") then {
                _key = format["CHILD:309:%1:%2:",_uid,_garagelist];
            } else {
                _key = format["CHILD:303:%1:%2:",_objectID,_garagelist];
            };
            _key call server_hiveWrite;
        } else {
    if (_object isKindOf "TrapItems") then {
        _inventory = [["armed",_object getVariable ["armed",false]]];
    } else {
        _isNormal = true;
    };
        
        
        if (DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ")) then {
            _isNormal = false;
            _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked)) then {
            _isNormal = false;
            _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (_isNormal) then {
            _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object];
        };
    };
    
    _previous = str(_object getVariable["lastInventory",[]]);
    if (str _inventory != _previous) then {
        _object setVariable["lastInventory",_inventory];
        if (_objectID == "0") then {
            _key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
        } else {
            _key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
        };
        if (Z_SingleCurrency) then {
            _coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
            _key = _key + str _coins + ":";
        };
        
        #ifdef OBJECT_DEBUG
            diag_log ("HIVE: WRITE: "+ str(_key));
        #endif
        
        _key call server_hiveWrite;
    };
};

_object_damage = {
    //Allow dmg process
    private ["_hitpoints","_array","_hit","_selection","_key","_damage","_allFixed"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            _damage = damage _object;
            _array = _object getVariable ["GarageFriends",[]];
            _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
            _key call server_hiveWrite;
    } else {
    
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    _allFixed = true;
    
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _allFixed = false;
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit]; 
        } else {
            _array set [count _array,[_selection,0]]; 
        };
        } forEach _hitpoints;
    };
    if (_allFixed && !_totalDmg) then {_object setDamage 0;};
    
    if (_forced) then {        
        if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
        _recorddmg = true;           
    } else {
        //Prevent damage events for the first 10 seconds of the servers live.
        if (diag_ticktime - _lastUpdate > 10) then {
            if !(_object in needUpdate_objects) then {
                //diag_log format["DEBUG: Monitoring: %1",_object];
                needUpdate_objects set [count needUpdate_objects, _object];
                _recorddmg = true;
            };
        };

    
    if (_recorddmg) then {
        if (_objectID == "0") then {
            _key = format["CHILD:306:%1:",_objectUID] + str _array + ":" + str _damage + ":";
        } else {
            _key = format["CHILD:306:%1:",_objectID] + str _array + ":" + str _damage + ":";
        };
        
        diag_log ("HIVE: WRITE: "+ str(_key));
        _key call server_hiveWrite;   
    };
};
};

Link to comment
Share on other sites

  • 0
On 12/28/2016 at 9:07 PM, juandayz said:

This garage uses an inventory to save vehicles? Like safes or tents? Cuz in the code that i give u (server monitor) i define the object garage as an object without inventory s

SAme as plots,doors..

 

Yes - it uses the inventory to store the vehicles.

Link to comment
Share on other sites

  • 0

We need to set the GarageFriends variable when it is spawned in by the server. This is what I would do:

In server_monitor.sqf - use @juandayz's fix:

Find:

if( (count _inventory > 0) && !_isPlot && !_doorLocked) then {

Replace with:

if( (count _inventory > 0) && !_isPlot && !_doorLocked && (_type != "Garbage_container") ) then {

Then find (approx. line 237):

if (DZE_permanentPlot && _isPlot) then {
	_object setVariable ["plotfriends", _inventory, true];
};
if (DZE_doorManagement && _doorLocked) then {
	_object setVariable ["doorfriends", _inventory, true];
};

Replace that with this:

if (DZE_permanentPlot && _isPlot) then {
	_object setVariable ["plotfriends", _inventory, true];
};
if (DZE_doorManagement && _doorLocked) then {
	_object setVariable ["doorfriends", _inventory, true];
};
if (_type == "Garbage_container") then {
	_object setVariable ["GarageFriends", _inventory, true];
};

 

Link to comment
Share on other sites

  • 0
8 hours ago, BigEgg said:

We need to set the GarageFriends variable when it is spawned in by the server. This is what I would do:

In server_monitor.sqf - use @juandayz's fix:

Find:


if( (count _inventory > 0) && !_isPlot && !_doorLocked) then {

Replace with:


if( (count _inventory > 0) && !_isPlot && !_doorLocked && (_type != "Garbage_container") ) then {

Then find (approx. line 237):


if (DZE_permanentPlot && _isPlot) then {
	_object setVariable ["plotfriends", _inventory, true];
};
if (DZE_doorManagement && _doorLocked) then {
	_object setVariable ["doorfriends", _inventory, true];
};

Replace that with this:


if (DZE_permanentPlot && _isPlot) then {
	_object setVariable ["plotfriends", _inventory, true];
};
if (DZE_doorManagement && _doorLocked) then {
	_object setVariable ["doorfriends", _inventory, true];
};
if (_type == "Garbage_container") then {
	_object setVariable ["GarageFriends", _inventory, true];
};

 

I did give this a shot to no availability and am getting the same errors as described above

This error here is client sided




Error in expression <lect 1;
_clr1 = _x select 2;
_clr2 = _x select 3;
_inv = _x select 4;
_fuel = _x>
  Error position: <select 3;
_inv = _x select 4;
_fuel = _x>
  Error parsenumber: Zero divisor
File mpmissions\__CUR_MP.Chernarus\custom\Garage\garage_storedvehicles.sqf, line 15

This is an error here in the is on server side but is pertaining to the server update object

22:11:01 "VIRTUAL GARAGE: Player JimBeanBingBanger (76561198052276084) has stored a 350z_ruben | [["350z_ruben","8952","0","0",[[[],[]],[[],[]],[[],[]]],0.997181,0,[]]]"
22:11:01 Error in expression <then {
_key = format["CHILD:309:%1:%2:",_uid,_garagelist];
} else {
_key = forma>
22:11:01   Error position: <_uid,_garagelist];
} else {
_key = forma>
22:11:01   Error Undefined variable in expression: _uid
22:11:01 File z\addons\dayz_server\compile\server_updateObject.sqf, line 80

Server update object line where the edits being done to it for virtual garage are here below

_object_inventory = {
    private ["_inventory","_key","_isNormal","_coins","_garagelist","_uid"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            if (isNil "_garagelist") then {
                _garagelist = _object getVariable ["StoredVehicles",[]];
            };
            if (_objectID == "0") then {
                _key = format["CHILD:309:%1:%2:",_uid,_garagelist];
            } else {
                _key = format["CHILD:303:%1:%2:",_objectID,_garagelist];
            };
            _key call server_hiveWrite;
        } else {
    if (_object isKindOf "TrapItems") then {
        _inventory = [["armed",_object getVariable ["armed",false]]];
    } else {
        _isNormal = true;
    };
        
        
        if (DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ")) then {
            _isNormal = false;
            _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked)) then {
            _isNormal = false;
            _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (_isNormal) then {
            _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object];
        };
    
    _previous = str(_object getVariable["lastInventory",[]]);
    if (str _inventory != _previous) then {
        _object setVariable["lastInventory",_inventory];
        if (_objectID == "0") then {
            _key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
        } else {
            _key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
        };
        if (Z_SingleCurrency) then {
            _coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
            _key = _key + str _coins + ":";
        };
        
        #ifdef OBJECT_DEBUG
            diag_log ("HIVE: WRITE: "+ str(_key));
        #endif
        
        _key call server_hiveWrite;
    };
};
};

_object_damage = {
    //Allow dmg process
    private ["_hitpoints","_array","_hit","_selection","_key","_damage","_allFixed"];
    
    // garage
    if ((typeOf _object) in DZE_Garage) then {
            _damage = damage _object;
            _array = _object getVariable ["GarageFriends",[]];
            _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
            _key call server_hiveWrite;
    } else {
    
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    _allFixed = true;
    
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _allFixed = false;
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit]; 
        } else {
            _array set [count _array,[_selection,0]]; 
        };
        } forEach _hitpoints;
    };
    if (_allFixed && !_totalDmg) then {_object setDamage 0;};
    
    if (_forced) then {        
        if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
        _recorddmg = true;           
    } else {
        //Prevent damage events for the first 10 seconds of the servers live.
        if (diag_ticktime - _lastUpdate > 10) then {
            if !(_object in needUpdate_objects) then {
                //diag_log format["DEBUG: Monitoring: %1",_object];
                needUpdate_objects set [count needUpdate_objects, _object];
                _recorddmg = true;
            };
        };

    
    if (_recorddmg) then {
        if (_objectID == "0") then {
            _key = format["CHILD:306:%1:",_objectUID] + str _array + ":" + str _damage + ":";
        } else {
            _key = format["CHILD:306:%1:",_objectID] + str _array + ":" + str _damage + ":";
        };
        
        diag_log ("HIVE: WRITE: "+ str(_key));
        _key call server_hiveWrite;   
    };
};
};

Link to comment
Share on other sites

  • 0
2 minutes ago, BigEgg said:

In your server_updateObject.sqf:

Replace:


_key = format["CHILD:309:%1:%2:",_uid,_garagelist];

With:


_key = format["CHILD:309:%1:%2:",_objectUID,_garagelist];

 

Then paste your garage_storedVehicles here.

This here is the garage stored vehicles
Also i have already changed the _uid to _objectuid while attempting to fix all of this to no availability


 

/*** Created by 0verHeaT ***/
private ["_storedvehicles","_maxstorage"];
_storedvehicles = VirtualGarage getVariable ["StoredVehicles",[]];
_maxstorage = 10; //Number of max stored vehicles
((uiNamespace getVariable "GarageDialog") displayCtrl 5203) ctrlSetStructuredText parseText format["<t align='right'>Vehicles Stored (%1/%2)</t>",(count _storedvehicles),_maxstorage];

lbClear 5201;

VehStoredList = [];
{
    private ["_class","_vehname","_index","_clr1","_clr2","_cid","_fuel","_dmg","_inv","_hit","_data","_key","_keyname"];
    _class = _x select 0;
    _cid = _x select 1;
    _clr1 = _x select 2;
    _clr2 = _x select 3;
    _inv = _x select 4;
    _fuel = _x select 5;
    _dmg = _x select 6;
    _hit = _x select 7;
    _cid = parsenumber _cid;
    if (_cid == 0) then {_key = ""};
    if ((_cid > 0) && (_cid <= 2500)) then {_key = format["ItemKeyGreen%1",_cid];};
    if ((_cid > 2500) && (_cid <= 5000)) then {_key = format["ItemKeyRed%1",_cid-2500];};
    if ((_cid > 5000) && (_cid <= 7500)) then {_key = format["ItemKeyBlue%1",_cid-5000];};
    if ((_cid > 7500) && (_cid <= 10000)) then {_key = format["ItemKeyYellow%1",_cid-7500];};
    if ((_cid > 10000) && (_cid <= 12500)) then {_key = format["ItemKeyBlack%1",_cid-10000];};
    _vehname = getText(configFile >> "cfgVehicles" >> _class >> "displayName");
    _keyname = getText(configFile >> "CfgWeapons" >> _key >> "displayName");
    _index = lbAdd[5201,format["%1 (%2)",_vehname,_keyname]];
    _data = [[_class,_cid,_clr1,_clr2,_inv,_fuel,_dmg,_hit],_key];
    VehStoredList set[count VehStoredList,_data];
} count _storedvehicles;

 

 

Link to comment
Share on other sites

  • 0

Replace the stuff you posted from your server_updateObject.sqf with this:

Spoiler

_object_inventory = {
    private ["_inventory","_key","_isNormal","_coins","_garagelist","_uid"];
    
    if (_object isKindOf "TrapItems") then {
        _inventory = [["armed",_object getVariable ["armed",false]]];
    } else {
        _isNormal = true;
        
        if (DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ")) then {
            _isNormal = false;
            _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked)) then {
            _isNormal = false;
            _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (_isNormal) then {
            _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object];
        };
	};
    
    _previous = str(_object getVariable["lastInventory",[]]);
    if (str _inventory != _previous) then {
		// Garage Edit
		if ((typeOf _object) in DZE_Garage) then {
				if (isNil "_garagelist") then {
					_garagelist = _object getVariable ["StoredVehicles",[]];
				};
				if (_objectID == "0") then {
					_key = format["CHILD:309:%1:%2:",_objectUID,_garagelist];
				} else {
					_key = format["CHILD:303:%1:%2:",_objectID,_garagelist];
				};
				_key call server_hiveWrite;
		// Normal Stuff
		} else {
			_object setVariable["lastInventory",_inventory];
			if (_objectID == "0") then {
				_key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
			} else {
				_key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
			};
			if (Z_SingleCurrency) then {
				_coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
				_key = _key + str _coins + ":";
			};
			
			#ifdef OBJECT_DEBUG
				diag_log ("HIVE: WRITE: "+ str(_key));
			#endif
			
			_key call server_hiveWrite;
		};
    };
};

_object_damage = {
    //Allow dmg process
    private ["_hitpoints","_array","_hit","_selection","_key","_damage","_allFixed"];
    
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    _allFixed = true;
    
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _allFixed = false;
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit]; 
        } else {
            _array set [count _array,[_selection,0]]; 
        };
    } forEach _hitpoints;
	
    if (_allFixed && !_totalDmg) then {_object setDamage 0;};
    
    if (_forced) then {        
        if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
        _recorddmg = true;           
    } else {
        //Prevent damage events for the first 10 seconds of the servers live.
        if (diag_ticktime - _lastUpdate > 10) then {
            if !(_object in needUpdate_objects) then {
                //diag_log format["DEBUG: Monitoring: %1",_object];
                needUpdate_objects set [count needUpdate_objects, _object];
                _recorddmg = true;
            };
        };
	};

    
    if (_recorddmg) then {
		// Garage Edit
		if ((typeOf _object) in DZE_Garage) then {
            _damage = damage _object;
            _array = _object getVariable ["GarageFriends",[]];
            _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
            _key call server_hiveWrite;
		// Normal Stuff
		} else {
			if (_objectID == "0") then {
				_key = format["CHILD:306:%1:",_objectUID] + str _array + ":" + str _damage + ":";
			} else {
				_key = format["CHILD:306:%1:",_objectID] + str _array + ":" + str _damage + ":";
			};
			diag_log ("HIVE: WRITE: "+ str(_key));
			_key call server_hiveWrite;
		};
    };
};

 

 

 

Link to comment
Share on other sites

  • 0
34 minutes ago, BigEgg said:

Replace the stuff you posted from your server_updateObject.sqf with this:

  Reveal hidden contents


_object_inventory = {
    private ["_inventory","_key","_isNormal","_coins","_garagelist","_uid"];
    
    if (_object isKindOf "TrapItems") then {
        _inventory = [["armed",_object getVariable ["armed",false]]];
    } else {
        _isNormal = true;
        
        if (DZE_permanentPlot && (typeOf (_object) == "Plastic_Pole_EP1_DZ")) then {
            _isNormal = false;
            _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (DZE_doorManagement && (typeOf (_object) in DZE_DoorsLocked)) then {
            _isNormal = false;
            _inventory = _object getVariable ["doorfriends", []]; //We're replacing the inventory with UIDs for this item
        };
        
        if (_isNormal) then {
            _inventory = [getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object];
        };
	};
    
    _previous = str(_object getVariable["lastInventory",[]]);
    if (str _inventory != _previous) then {
		// Garage Edit
		if ((typeOf _object) in DZE_Garage) then {
				if (isNil "_garagelist") then {
					_garagelist = _object getVariable ["StoredVehicles",[]];
				};
				if (_objectID == "0") then {
					_key = format["CHILD:309:%1:%2:",_objectUID,_garagelist];
				} else {
					_key = format["CHILD:303:%1:%2:",_objectID,_garagelist];
				};
				_key call server_hiveWrite;
		// Normal Stuff
		} else {
			_object setVariable["lastInventory",_inventory];
			if (_objectID == "0") then {
				_key = format["CHILD:309:%1:",_objectUID] + str _inventory + ":";
			} else {
				_key = format["CHILD:303:%1:",_objectID] + str _inventory + ":";
			};
			if (Z_SingleCurrency) then {
				_coins = _object getVariable [Z_MoneyVariable, -1]; //set to invalid value if getVariable fails to prevent overwriting of coins in DB
				_key = _key + str _coins + ":";
			};
			
			#ifdef OBJECT_DEBUG
				diag_log ("HIVE: WRITE: "+ str(_key));
			#endif
			
			_key call server_hiveWrite;
		};
    };
};

_object_damage = {
    //Allow dmg process
    private ["_hitpoints","_array","_hit","_selection","_key","_damage","_allFixed"];
    
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    _allFixed = true;
    
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _allFixed = false;
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit]; 
        } else {
            _array set [count _array,[_selection,0]]; 
        };
    } forEach _hitpoints;
	
    if (_allFixed && !_totalDmg) then {_object setDamage 0;};
    
    if (_forced) then {        
        if (_object in needUpdate_objects) then {needUpdate_objects = needUpdate_objects - [_object];};
        _recorddmg = true;           
    } else {
        //Prevent damage events for the first 10 seconds of the servers live.
        if (diag_ticktime - _lastUpdate > 10) then {
            if !(_object in needUpdate_objects) then {
                //diag_log format["DEBUG: Monitoring: %1",_object];
                needUpdate_objects set [count needUpdate_objects, _object];
                _recorddmg = true;
            };
        };
	};

    
    if (_recorddmg) then {
		// Garage Edit
		if ((typeOf _object) in DZE_Garage) then {
            _damage = damage _object;
            _array = _object getVariable ["GarageFriends",[]];
            _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
            _key call server_hiveWrite;
		// Normal Stuff
		} else {
			if (_objectID == "0") then {
				_key = format["CHILD:306:%1:",_objectUID] + str _array + ":" + str _damage + ":";
			} else {
				_key = format["CHILD:306:%1:",_objectID] + str _array + ":" + str _damage + ":";
			};
			diag_log ("HIVE: WRITE: "+ str(_key));
			_key call server_hiveWrite;
		};
    };
};

 

 

 

Mate thank you heaps, that actually did the trick for the vehicles saving. They are saving and spawning just fine now.

The garage friends list is not saving now though

 

[["T72_TK_EP1","12226","0","0",[[[],[]],[[],[]],[[],[]]],1,3.439e-04,[]]]

This^ is how the database looks after readding yourself to the garage manage menu friends list

Link to comment
Share on other sites

  • 0

In server_updateObjects.sqf Find this:

_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];

Replace with this:

if (_objectID == "0") then {
	_key = format["CHILD:306:%1:%2:%3:",_objectUID,_array,_damage];
} else {
	_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
};

 

Link to comment
Share on other sites

  • 0
22 minutes ago, BigEgg said:

In server_updateObjects.sqf Find this:


_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];

Replace with this:


if (_objectID == "0") then {
	_key = format["CHILD:306:%1:%2:%3:",_objectUID,_array,_damage];
} else {
	_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
};

 

Hmm strangely enough it appears to be saving the player id correctly in the inventory slot in the database when you first deploy it and add yourself to it but as soon as you add one vehicle to the garage it overwrites the player id with the vehicle in the database.

Therefore after restart the vehicle will remain in the garage menu but the player list is wiped (as per the database as well)

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