DayZ
100 ratings
AutolockVehicles
5
2
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod Type: Mechanics, Vehicle
File Size
Posted
Updated
44.500 KB
24 Feb, 2024 @ 5:50am
11 Feb @ 4:09am
9 Change Notes ( view )

Subscribe to download
AutolockVehicles

Description
Help

You can find me on my DayZ Development Discord[discord.gg]. Come there if you need help or have ideas!

Donations welcome

If you like this mod, please consider donating[paypal.me]! <3

Description

This mod automatically locks vehicles under certain conditions. Compatible with the four main vehicle locking mods:

There are some situations when it can be practical that vehicles automatically get locked:
  • Server crashes
  • Players missing restarts
  • Players getting disconnected
  • Crowded area situations
  • Players simply forgetting to lock

Configuration

At first install, a configuration file with these default values will be created in $profile:AutolockVehicles/AutolockVehicles.json

{ "debug_log_level": 1, "environment": 1, "use_key_mod": 0, "enable_proximity_autolock": 0, "enable_proximity_autounlock": 0, "enable_startup_autolock_timer": 0, "enable_disconnect_autolock_timer": 0, "enable_close_doors_on_autolock": 0, "enable_engine_off_on_autolock": 0, "lock_only_when_all_doors_are_closed": 1, "lock_only_when_no_players_inside": 0, "autolock_delay_startup_minutes": 2, "autolock_delay_player_disconnect_minutes": 1, "proximity_lock_distance_meters": 5, "proximity_unlock_distance_meters": 2 }

debug_log_level
Amount of log output to $profile:AutolockVerhicles.log. 1 means only display critical errors, while 5 makes it very chatty. On your live server, always have it on 1.

environment
Don't touch this unless you know what you're doing.

use_key_mod
The vehicle locking mod you want to use, which has to be installed and active.

use_key_mod value
locking mechanism
0 (default)
Custom mechanism (see below)
3

enable_startup_autolock_timer
Set this to 1 to enable automatic locking of vehicles whenever a vehicle is spawned. Spawning can be server startup, an admin spawning a vehicle, a player buying a vehicle from a trader, restoring a vehicle from a garage system, or other events.

If this feature is enabled, the mod will try to automatically lock the spawned vehicle after autolock_delay_startup_minutes.

enable_disconnect_autolock_timer
This feature will try to lock a vehicle when a player disconnects. It will only work on the last vehicle the player has unlocked, and only if they were the last player to unlock it. The setting that delays this action is autolock_delay_player_disconnect_minutes.

enable_proximity_autolock
This works like handsfree locking in real life: If a player unlocks a vehicle and then later moves farther away from it than defined by proximity_lock_distance_meters, the mod will try to lock it. Again, this only works if they were the last player to unlock it. If they enter the proximity again, it will be tried to unlock it, with the same checks as locking.

The constant distance measuring happens in the player's client, so it won't affect the server's performance. It does not require the player to have the key with them.

enable_proximity_autounlock

Same as above, but unlock. Notice that different proximities can be configured for lock or unlock. Never have proximity_lock_distance_meters less than 2, or it may not register.

lock_only_when_all_doors_are_closed
Some locking mechanisms behave in an unexpoected way if the doors are being programmatically locked while one or more doors are open. With this setting, you can determine that autolocking will only happen if all doors are closed, including the trunk.

This can also be helpful for groups of players that work on a shared vehicle at a trader location, so that their vehicle doesn't get locked if the player that last locked it runs to sell.

lock_only_when_no_players_inside

If set to 1, the mod will check if passengers are in the vehicle, right before locking, and if so, don't lock it.

enable_engine_off_on_autolock
enable_close_doors_on_autolock
These two settings determine if the mod should automatically shut down the vehicle's engine, or close its doors, on autolock. Please note that if lock_only_when_all_doors_are_closed is set, the doors won't get automatically closed.

Custom key mod
If you want to use a vehicle locking mechanism that isn't supported by this mod, you can extend GetVehicleState and LockVehicle of the class AutolockVehicles_Custom[github.com]. See the existing key mods[github.com] for reference.

You also have hook into the key mod's locking action to start the proximity process. Also, see the existing key mods[github.com] for reference.

Help

You can find me on the Enfusion Modders Discord (see below in the Credits), or DM (inkihh).

The code is public on Github[github.com], where you can create an issue[github.com] or look at the project board[github.com]. Feature ideas welcome!

Credits

Thanks to my "family" at FOG FamilyOfGamers, without their support I wouldn't have pushed through. Join their Discord[discord.gg] for the ultimative experience of how a DayZ community should be! Special thanks to Prs7 who encouraged me to make this mod compatible to different locking mechanisms and publish it.

Special thanks to the Enfusion Modders Discord[discord.gg] - without the constant help from these guys, I would have gone nowhere. Special thanks to Wardog, Tree, The Crimson Zamboni, Varyel, ◣▲▼▲, TrueDolphin, aff3nbart, Dmitri, LieutenantMaster and Helkhiana.

Extra special thanks to AVcrazy21 for designing this awesome steam workshop page icon!

Legalese
  • The mod may be repacked, if you get personal permission from me
  • The mod may be used on monetized servers, as long as Bohemia's monetization guidelines are followed
  • The mod may only be uploaded to the Steam Workshop under my account name (inkihh)

Copyright 2025 inkihh