Skip to content

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

ResourceRequiredNotes
twinded_libsYesFree shared library
Lockpick resourceNoDefault: lockpick — configurable, or use 'custom' handler
Sound resourceNoDefault: 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_doorlock

Config Files

FileDescription
settings.luaMain settings, door list, sound, lockpick, prompts
lang.luaTranslation strings
lockpick.luaCustom lockpick handler (when Config.Lockpick.type = 'custom')
sound.luaCustom sound handler (when Config.Sound.type = 'custom')
webhook.luaCustom webhook handler (when Config.Webhook.type = 'custom')

See the Configuration guide for how to override these files.

Configuration Reference

settings.lua

OptionTypeDefaultDescription
Config.MinDistancenumber2.0Default interaction distance (meters)
Config.Webhook.typestring"discord"'discord' or 'custom'
Config.Webhook.urlstring""Discord webhook URL
Config.Lockpick.typestring"lockpick"Lockpick resource name. Set to 'custom' for your own handler
Config.Lockpick.itemstring"lockpick"Required inventory item for lockpicking
Config.Lockpick.triesnumber3Number of lockpick attempts before failure
Config.Sound.typestring"xsound"Sound resource name. Set to 'custom' for your own handler
Config.Sound.enabledbooleantrueEnable lock/unlock sounds
Config.Sound.filestring"./sounds/lock.ogg"Sound file path
Config.Sound.volumenumber0.5Sound volume (0.0 to 1.0)
Config.Sound.rangenumber15.0Sound audible range (meters)
Config.WitnessJobstable or nil{"police", "sheriff"}Jobs notified on lockpick events (nil to disable)

Door Entry Fields

Each entry in Config.DoorList:

FieldTypeDescription
authorizedJobstable or nilJobs allowed to lock/unlock (nil = no job access)
authorizedItemstable or nilItems that grant access
objectnumberDoor object hash
objCoordsvector3Door world position
textCoordsvector3Prompt display position
objYawnumberDoor rotation angle
lockedbooleanDefault locked state
lockpickbooleanAllow lockpicking on this door
distancenumber or nilOverride interaction distance for this door
object2number or nilSecond door hash (for double-door sets)
objYaw2number or nilSecond 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

ProblemSolution
Script doesn't startMake sure twinded_libs is started before twinded_lgw_doorlock
Can't interact with doorsCheck Config.MinDistance and distance per door entry
No soundVerify Config.Sound.type matches your sound resource name
Lockpick not workingVerify Config.Lockpick.type matches your lockpick resource name
No webhook logsSet Config.Webhook.url and check Config.Webhook.type is 'discord'

Premium RedM Scripts — Multi-Framework