Jump to content
  • 0

Are vehicles being unlocked automatically?


lima

Question

Hi,

 

What is the default behavior when a locked vehicle are left somewhere on the map, and the key are gone (fx left on the ground)? Will the vehicle be unlocked or removed on server restat, or will it remain locked?

 

Regards, Lima.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Lockable vehicles are locked on server restart so unless you get rid of it then it will stay locked forever. If you have admin tools available and the vehicle has been abandoned for awhile, create a key for it, unlock it and throw it in the gear and put it up for grabs to your regular players.

Link to comment
Share on other sites

  • 0

You can also create a MYSQL event that will unlock abandoned cars after a certain period of time.  Here is what I am using.  Just edit to make the table name match the spelling and capitalization of your 'object_data' table.  This unlocks vehicles that are at least 4 days old and haven't been touched in 10 days.  You can change the numbers to reflect the time you want this to happen.

 

DROP EVENT IF EXISTS unlockAbandonedVehicles;
CREATE EVENT unlockAbandonedVehicles
ON SCHEDULE EVERY 1 DAY
COMMENT 'Unlocks vehicles that have been abandoned'
DO
UPDATE `Object_DATA` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 4 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL;
Link to comment
Share on other sites

  • 0

Lockable vehicles are locked on server restart so unless you get rid of it then it will stay locked forever. If you have admin tools available and the vehicle has been abandoned for awhile, create a key for it, unlock it and throw it in the gear and put it up for grabs to your regular players.

I have admin tools, but that won't help me much. I don't get all over the map - also I dont wanna be checking and remembering every vehicle that has been left around the map.

 

 

 

You can also create a MYSQL event that will unlock abandoned cars after a certain period of time.  Here is what I am using.  Just edit to make the table name match the spelling and capitalization of your 'object_data' table.  This unlocks vehicles that are at least 4 days old and haven't been touched in 10 days.  You can change the numbers to reflect the time you want this to happen.

 

DROP EVENT IF EXISTS unlockAbandonedVehicles;
CREATE EVENT unlockAbandonedVehicles
ON SCHEDULE EVERY 1 DAY
COMMENT 'Unlocks vehicles that have been abandoned'
DO
UPDATE `Object_DATA` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 4 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL;

 

Thanks, but I was hoping more of a script or something that could check if the key for a kar still exists. Your SQL is kindof my last resort :)

 

Do you know if a key thats left in the world on server restart will be removed from the database, or get marked somehow?

Link to comment
Share on other sites

  • 0

The latest Epoch SQL has a function (FindVehicleKeysCount) that identifies vehicles without keys anywhere in the database (player inventories, safes, etc.).  It is used by either another function (DeleteNonKeyVehicles) that then deletes these vehicles, or a scheduled job (UnlockNonKeyVehicles) that converts it.  You can find the SQL here:

 

https://github.com/vbawol/DayZ-Epoch/blob/master/Server%20Files/SQL/add_recommended_mysql_events.sql

 

With that said, unfortunately on my hosting provider I can't create functions, so I can't use either of them currently.  Hopefully you can...

 

GT

Link to comment
Share on other sites

  • 0

 

You can also create a MYSQL event that will unlock abandoned cars after a certain period of time.  Here is what I am using.  Just edit to make the table name match the spelling and capitalization of your 'object_data' table.  This unlocks vehicles that are at least 4 days old and haven't been touched in 10 days.  You can change the numbers to reflect the time you want this to happen.

 

DROP EVENT IF EXISTS unlockAbandonedVehicles;
CREATE EVENT unlockAbandonedVehicles
ON SCHEDULE EVERY 1 DAY
COMMENT 'Unlocks vehicles that have been abandoned'
DO
UPDATE `Object_DATA` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 4 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL;

 

I used this and modified it to include WoodCrate_DZ,OutHouse_DZ,GunRack_DZ - also changed it to 7 days from 4.  Helps clear up some of the unwanted crap on the server.

Link to comment
Share on other sites

  • 0

The latest Epoch SQL has a function (FindVehicleKeysCount) that identifies vehicles without keys anywhere in the database (player inventories, safes, etc.).  It is used by either another function (DeleteNonKeyVehicles) that then deletes these vehicles, or a scheduled job (UnlockNonKeyVehicles) that converts it.  You can find the SQL here:

 

https://github.com/vbawol/DayZ-Epoch/blob/master/Server%20Files/SQL/add_recommended_mysql_events.sql

 

With that said, unfortunately on my hosting provider I can't create functions, so I can't use either of them currently.  Hopefully you can...

 

GT

 

Thanks alot, that was exactly what I was looking for. Fortunately my server provider does let me create functions.

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