Paul

Vehicle Auto Lock

9 posts in this topic

Hi Guys,

Is there a way to make vehicles/doors automatically lock on restart?

I know it should be down to the players to lock their stuff, but we're a PVE server, so people shouldn't be base raiding anyway. 

Paul

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

@canuckbrian, no, the server saves the state of your locks and persists that through restarts.

@Paul, you need to change three files:

1) ExileServer_object_construction_database_load -- This is for doors

	//_constructionObject setVariable ["ExileIsLocked",(_data select 14),true];
	_constructionObject setVariable ["ExileIsLocked",-1,true]; //Modification to lock items on server restart - Apoc

2) ExileServer_object_container_database_load --This is for safes

	//_containerObject setVariable ["ExileIsLocked",(_data select 3),true];
	_containerObject setVariable ["ExileIsLocked",-1,true]; //Modification to lock on server restart - Apoc

3) ExileServer_object_vehicle_database_load --This is for vehicle doors

//if(_lock isEqualTo -1)then
if(TRUE)then	//Modification to lock all vehicles on server restart - Apoc

Boom, and you're done.

Edited by Apoc
clarity in comment
  • Like 1

Share this post


Link to post
Share on other sites

Isn't everything locked after restart anyways? 

No, if you leave it unlocked when the server restarts, it unlocked after

@canuckbrian, no, the server saves the state of your locks and persists that through restarts.

@Paul, you need to change three files:

1) ExileServer_object_construction_database_load -- This is for doors

	//_constructionObject setVariable ["ExileIsLocked",(_data select 14),true];
	_constructionObject setVariable ["ExileIsLocked",-1,true]; //Modification to lock items on server restart - Apoc

2) ExileServer_object_container_database_load --This is for safes

	//_containerObject setVariable ["ExileIsLocked",(_data select 3),true];
	_containerObject setVariable ["ExileIsLocked",-1,true]; //Modification to lock on server restart - Apoc

3) ExileServer_object_vehicle_database_load --This is for vehicle doors

//if(_lock isEqualTo -1)then
if(TRUE)then	//Modification to lock all vehicles on server restart - Apoc

Boom, and you're done.

Thanks, i'll see if i can give these a go :)

Share this post


Link to post
Share on other sites

Hi, i cant find the line

//if(_lock isEqualTo -1)then
if(TRUE)then	//Modification to lock all vehicles on server restart - Apoc
Spoiler

/**
 * ExileServer_object_vehicle_database_load
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_vehicleID","_data","_position","_vectorDirection","_vectorUp","_pinCode","_vehicleObject","_lock","_unlockInSafeZonesAfterRestart","_isLocked","_hitpoints","_cargoContainers"];
_vehicleID = _this;
_data = format ["loadVehicle:%1", _vehicleID] call ExileServer_system_database_query_selectSingle;
_position = [_data select 8, _data select 9, _data select 10];
_vectorDirection = [_data select 11, _data select 12, _data select 13];
_vectorUp = [_data select 14, _data select 15, _data select 16];
_pinCode = _data select 20;
_vehicleObject = [(_data select 1), _position, [_vectorDirection, _vectorUp], true,_pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
_vehicleObject setVariable ["ExileDatabaseID", _vehicleID];
_vehicleObject setVariable ["ExileOwnerUID", (_data select 3)];
_lock = (_data select 4);
_unlockInSafeZonesAfterRestart = (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "unlockInSafeZonesAfterRestart")) isEqualTo 1;
_isLocked = (_lock isEqualTo -1);
if (_isLocked) then 
{
    if (_unlockInSafeZonesAfterRestart) then 
    {
        if (_position call ExileClient_util_world_isInTraderZone) then 
        {
            _isLocked = false;
        };
    };
};
if (_isLocked) then
{
    _vehicleObject setVariable ["ExileIsLocked", -1];
    //_vehicleObject lock 2;
    _vehicleObject lock 0;
    _vehicleObject enableRopeAttach false;
}
else
{
    _vehicleObject setVariable ["ExileIsLocked", 0];
    _vehicleObject lock 0;
    _vehicleObject enableRopeAttach true;
};
_vehicleObject setFuel (_data select 5);
_vehicleObject setDamage (_data select 6);
_hitpoints = _data select 7;
if ((typeName _hitpoints) isEqualTo "ARRAY") then 
{
    {
        _vehicleObject setHitPointDamage [_x select 0, _x select 1];
    }
    forEach _hitpoints;
};
[_vehicleObject, (_data select 17)] call ExileServer_util_fill_fillItems;
[_vehicleObject, (_data select 18)] call ExileServer_util_fill_fillMagazines;
[_vehicleObject, (_data select 19)] call ExileServer_util_fill_fillWeapons;
_cargoContainers = format ["loadVehicleContainer:%1", _vehicleID] call ExileServer_system_database_query_selectSingle;
if ((typeName _cargoContainers) isEqualTo "ARRAY") then 
{
    if !(_cargoContainers isEqualTo []) then
    {
        [_vehicleObject, (_cargoContainers select 0)] call ExileServer_util_fill_fillContainers;
    };
};
_vehicleObject enableSimulationGlobal false;
_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;
if (_vehicleObject call ExileClient_util_world_isInTraderZone) then 
{
    _vehicleObject allowDamage false;
};
_vehicleObject

Share this post


Link to post
Share on other sites

Here is 1.0.3 location for last one (I think). Line 49

Seems to work ok.

Spoiler

_isLocked = true; //(_lock isEqualTo -1); <-----HERE
if (_isLocked) then 
{
    if (_unlockInSafeZonesAfterRestart) then 
    {
        if (_position call ExileClient_util_world_isInTraderZone) then 
        {
            _isLocked = false;
        };
    };
};
if (_isLocked) then
{
    _vehicleObject setVariable ["ExileIsLocked", -1];
    _vehicleObject lock 2;
    _vehicleObject enableRopeAttach false;
}
else
{
    _vehicleObject setVariable ["ExileIsLocked", 0];
    _vehicleObject lock 0;
    _vehicleObject enableRopeAttach true;
};

Edited by ranathane
missed a semicolon

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.