twinded_lgw_doorlock
A door lock/unlock system for RedM. Manage doors with job and item-based authorization, key animations, lockpicking minigame, and Discord webhook logging.
Dependencies
| Resource | Required | Notes |
|---|---|---|
| twinded_libs | Yes | Free shared library |
| Lockpick resource | No | Default: lockpick — configurable, or use 'custom' handler |
| Sound resource | No | Default: xsound — configurable, or use 'custom' handler |
Compatibility
Cross-framework — works with VORP, RSG, QBCore RedM, QRCore, RedEM:RP, RPX, TPZ-CORE, and FRP. Framework is auto-detected by twinded_libs.
Installation
bash
ensure twinded_libs
ensure twinded_lgw_doorlockConfig Files
| File | Description |
|---|---|
settings.lua | Main settings, door list, sound, lockpick, prompts |
lang.lua | Translation strings |
lockpick.lua | Custom lockpick handler (when Config.Lockpick.type = 'custom') |
sound.lua | Custom sound handler (when Config.Sound.type = 'custom') |
webhook.lua | Custom webhook handler (when Config.Webhook.type = 'custom') |
See the Configuration guide for how to override these files.
Configuration Reference
settings.lua
| Option | Type | Default | Description |
|---|---|---|---|
Config.MinDistance | number | 2.0 | Default interaction distance (meters) |
Config.Webhook.type | string | "discord" | 'discord' or 'custom' |
Config.Webhook.url | string | "" | Discord webhook URL |
Config.Lockpick.type | string | "lockpick" | Lockpick resource name. Set to 'custom' for your own handler |
Config.Lockpick.item | string | "lockpick" | Required inventory item for lockpicking |
Config.Lockpick.tries | number | 3 | Number of lockpick attempts before failure |
Config.Sound.type | string | "xsound" | Sound resource name. Set to 'custom' for your own handler |
Config.Sound.enabled | boolean | true | Enable lock/unlock sounds |
Config.Sound.file | string | "./sounds/lock.ogg" | Sound file path |
Config.Sound.volume | number | 0.5 | Sound volume (0.0 to 1.0) |
Config.Sound.range | number | 15.0 | Sound audible range (meters) |
Config.WitnessJobs | table or nil | {"police", "sheriff"} | Jobs notified on lockpick events (nil to disable) |
Door Entry Fields
Each entry in Config.DoorList:
| Field | Type | Description |
|---|---|---|
authorizedJobs | table or nil | Jobs allowed to lock/unlock (nil = no job access) |
authorizedItems | table or nil | Items that grant access |
object | number | Door object hash |
objCoords | vector3 | Door world position |
textCoords | vector3 | Prompt display position |
objYaw | number | Door rotation angle |
locked | boolean | Default locked state |
lockpick | boolean | Allow lockpicking on this door |
distance | number or nil | Override interaction distance for this door |
object2 | number or nil | Second door hash (for double-door sets) |
objYaw2 | number or nil | Second door rotation angle |
lockpick.lua
Custom lockpick handler (when Config.Lockpick.type = 'custom'):
lua
RegisterNetEvent('twinded_lgw_doorlock:customLockpick', function(tries, cb)
-- Start your lockpick minigame
-- Call cb(true) on success, cb(false) on failure
end)sound.lua
Custom sound handler (when Config.Sound.type = 'custom'):
lua
RegisterNetEvent('twinded_lgw_doorlock:customSound', function(soundId, file, volume, coords, range)
-- Play your custom sound
end)Features
- Job-based authorization — Restrict doors to specific jobs (sheriff, doctor, etc.)
- Item-based authorization — Allow access with specific inventory items
- Key animation — Realistic key animation with prop attachment
- Lockpicking — Configurable lockpick minigame with item consumption
- Double doors — Support for double-door sets with synchronized state
- 3D positional sound — Lock/unlock sounds audible by nearby players
- Lock icon — Visual lock indicator (red = locked, green = unlocked)
- State persistence — Door states persist during server session
- State sync — Door states broadcast to all players in real-time
- Witness alerts — Notify law enforcement players when a door is lockpicked
- Custom handlers — Override lockpick minigame and sound system with your own implementation
- Rate limiting — Anti-spam cooldown
Troubleshooting
| Problem | Solution |
|---|---|
| Script doesn't start | Make sure twinded_libs is started before twinded_lgw_doorlock |
| Can't interact with doors | Check Config.MinDistance and distance per door entry |
| No sound | Verify Config.Sound.type matches your sound resource name |
| Lockpick not working | Verify Config.Lockpick.type matches your lockpick resource name |
| No webhook logs | Set Config.Webhook.url and check Config.Webhook.type is 'discord' |

