Agency Docs
Standalone

Agency-Doorlock Configuration

The smartest way to lock down your city. Agency-Doorlock turns any door into a secure, persistent lock with effortless.

v1.4.1Free6 Pages

01Configuration

Quick Installation · config.lua · Agency-Doorlock

Download config.lua

--[[ ╔══════════════════════════════════════════════════════════════════════╗ ║ AGENCY DOORLOCK - CONFIGURATION ║ ║ (c) Agency Scripts ║ ╚══════════════════════════════════════════════════════════════════════╝ Lockable doors with E & Target, easy in-game setup, Job / Gang / Grade, per-player and item-key access. QB / QBox / ESX / Standalone auto-detect. CONTENTS 1. Agency Companion The free app for your players, accent colour 2. Core Language, framework, notifications, debug 3. Interaction Key / target, prompt, interaction range 4. Item Keys Items that lock and unlock doors 5. Door Behaviour Lock closes door, hold open (garage doors, gates) 6. Sound & Animation Lock sound, hand animation 7. Setup /adoorlock command, permissions, door detection 8. Visuals Colours, door marker 9. Static Doors Doors defined in this file instead of in-game No version number in this file, on purpose: your config is kept across updates, so a number here would go stale and misreport your install. The version you are running is the one in fxmanifest.lua, please quote that one in support. Ad-free and re-brandable: Agency-Essentials (Doorlock + Notify + Progressbar + Elevator + Reports in one resource) https://agency-script.tebex.io/package/essentials Discord: https://discord.gg/RTax3aBMUs · Shop: https://shop.agencyg.de ]] Config = {} --============================================================================== -- 1 · AGENCY COMPANION --============================================================================== -- Agency-Companion (free): https://shop.agencyg.de/en/product/agency-companion -- One resource for every Agency script: your players link them with the free -- Agency Companion app (iPhone, Android, web) using ONE code (/app), see their -- doors and lock / unlock the ones they have access to from the phone; admins -- override or delete any door remotely and pick one accent colour for all -- Agency scripts in game (/app, admin page). Drop it into your resources, done. -- Without Agency-Companion the doorlock keeps its own pairing window -- (/adlconnect, alias /adlc). -- The pairing token can NEVER grant admin, every admin action re-checks rights. Config.Companion = { Enabled = true, -- connect with the Agency Companion app (and Agency-Companion) EnableRemote = true, -- false = players can link, but nothing is controlled remotely ToggleDistance = 20.0, -- metres a player must be from a door to use it -- from the app (admins bypass this) RelayUrl = 'https://api.agencyg.de', -- do not change unless self-hosting TokenTTL = 300, -- seconds a pairing QR / 6-digit code stays valid DownloadUrl = 'https://shop.agencyg.de/en/product/agency-companion', } -- ── Accent colour ──────────────────────────────────────────────────────────── -- false = the colour from Agency-Companion, gold without it -- { r,g,b } = a fixed colour for this script's menus only, e.g. { 0, 190, 255 } Config.AccentColor = false --============================================================================== -- 2 · CORE --============================================================================== -- ── Language ───────────────────────────────────────────────────────────────── -- Default is English. English is the fallback for any missing text. -- en bg cs da de el es fi fr hr hu it ja ko nb nl pl pt ro ru sk sv tr uk zh Config.Locale = 'en' -- ── Framework ──────────────────────────────────────────────────────────────── -- 'auto' = detect QBox (qbx_core), QBCore or ESX (recommended) -- 'qb' / 'qbx' / 'esx' = force a framework -- 'standalone' = no framework: only "everyone" and per-player (identifier) -- access are enforced. Job / Gang locks need QB, QBox or ESX. Config.Framework = 'auto' -- ── Notifications ──────────────────────────────────────────────────────────── -- Agency-Notify (free): https://agency-script.tebex.io/package/6937769 -- 'agency-notify' = Agency-Notify whenever it runs (also inside Agency-Essentials), -- the framework notification otherwise -- 'framework' = always the QBCore / ESX built-in notification -- 'none' = no notifications Config.NotifySystem = 'agency-notify' -- ── Debug ──────────────────────────────────────────────────────────────────── -- Prints access-check details to the server console. Set false when live. Config.Debug = false --============================================================================== -- 3 · INTERACTION --============================================================================== -- ── Mode ───────────────────────────────────────────────────────────────────── -- 'key' = press Config.InteractKey at the door (uses the Text UI) -- 'target' = ox_target / qb-target eye option -- 'both' = key prompt AND target option (recommended) Config.Interaction = 'both' Config.InteractKey = 38 -- control id, 38 = E Config.InteractKeyLabel = 'E' -- shown on the prompt keycap Config.TargetSystem = 'ox_target' -- 'ox_target' | 'qb-target' -- ── Prompt ─────────────────────────────────────────────────────────────────── -- 'default' = built-in prompt (no dependency) -- 'jg-textui' = https://github.com/jgscripts/jg-textui Config.TextUISystem = 'default' -- Master switch for the [E] prompt. Leave true: hiding the prompt for SINGLE -- doors is done per door in the setup UI ("Hide [E] prompt"). Config.ShowPrompt = true Config.DrawDistance = 12.0 -- metres before a door's prompt is drawn (performance) -- ── Range ──────────────────────────────────────────────────────────────────── -- DEFAULT range (metres) in which a player can lock AND unlock a door. Every -- door can override it in /adoorlock ("Interaction range"), which large -- garage doors and gates need: their centre point sits several metres from -- where a player can actually stand. Doors without an override use this value. Config.InteractDistance = 1.6 -- Upper limit for the per-door override, so a mistyped value can't make a -- door operable from across the map. Enforced server-side on save. Config.MaxInteractDistance = 50.0 --============================================================================== -- 4 · ITEM KEYS --============================================================================== -- Doors can be opened with items: a key, a keycard, a badge. Which items open -- a door is set PER DOOR in /adoorlock (tab "Items"). A player carrying one of -- those items may lock and unlock the door, like a job or player grant. -- -- Items are checked last: a player who already has access through a job, gang, -- player grant or "Everyone" never uses up an item. -- -- Supported inventories: ox_inventory, qb-inventory / ps-inventory (QBCore), -- ESX. Works on QBox through ox_inventory. -- -- This block is OPTIONAL. If an older config.lua doesn't have it, item keys -- stay enabled with the defaults below. Config.ItemKeys = { Enable = true, -- master switch for item keys Inventory = 'auto', -- 'auto' | 'ox_inventory' | 'framework' -- Items that open EVERY door, no matter what the door allows. -- Example: { 'master_key' } MasterItems = {}, -- Items that are used up (one removed) each time they lock or unlock a door. -- Example: { ['keycard_single'] = true } ConsumeItems = {}, } --============================================================================== -- 5 · DOOR BEHAVIOUR --============================================================================== -- ── Locking ────────────────────────────────────────────────────────────────── -- true = a locked door is always closed and locked (reliable, default) -- false = a locked door that's open stays movable until it swings shut, then latches Config.LockClosesDoor = true -- How long (seconds) an open door takes to swing shut before it latches, when it -- gets locked while standing open. 0 = lock instantly where it stands (old behaviour). -- Garage doors / gates with "Hold open" keep their own close-then-lock movement. Config.LockCloseTime = 0.8 -- ── Hold open (garage doors, shutters, gates) ──────────────────────────────── -- Garage doors roll shut on their own as soon as nobody is near. With -- "Hold open" ticked ON A DOOR in /adoorlock: -- unlocked -> the gate opens and STAYS open, by itself -- locked -> the gate closes and locks, as normal -- It is a per-door setting, every other door behaves exactly as before. -- How far the gate travels while held open. 1.0 = fully open. Lower it for -- shutters that clip into geometry when fully raised (e.g. 0.9). Config.HoldOpenRatio = 1.0 -- How close a player has to be for the hold to be re-applied. The game rolls -- these doors shut every time they stream back in, so this must cover the -- distance the gate is visible from. Raise it for very large gates. Config.HoldOpenDistance = 60.0 --============================================================================== -- 6 · SOUND & ANIMATION --============================================================================== -- ── Sound ──────────────────────────────────────────────────────────────────── -- Plays the real door bolt sound (html/door-bolt-4.ogg) on lock / unlock, -- heard by players near the door. Config.PlaySound = true Config.Sounds = {} -- no longer used, kept for older configs -- ── Animation ──────────────────────────────────────────────────────────────── -- Short forward hand-reach played on the player who toggles the door (no prop). Config.Animation = { enabled = true, dict = 'anim@heists@keycard@', name = 'exit', duration = 1100, -- ms } --============================================================================== -- 7 · SETUP --============================================================================== -- ── Commands ───────────────────────────────────────────────────────────────── Config.SetupCommand = 'adoorlock' -- opens the in-game door setup Config.SetupCommandAlias = 'adl' -- short alias, '' = none -- ── Permission ─────────────────────────────────────────────────────────────── -- Who may open the setup and create / delete doors: -- 'ace' = ACE permission Config.SetupAce (server-sided, secure) -- 'admin' = QBCore / QBox / ESX admin or god (ace 'command' as fallback) -- 'job' = one of the jobs in Config.SetupJobs Config.SetupPermission = 'admin' Config.SetupAce = 'agency.doorlock' -- used when SetupPermission = 'ace' Config.SetupJobs = { ['mechanic'] = 0 } -- used when SetupPermission = 'job' (job = min grade) -- ── Door selection ─────────────────────────────────────────────────────────── -- During setup a marker sits where you look. Aim it at a door and press [E]. Config.SetupRayDistance = 7.0 -- how far in front the selector reaches -- Auto-pair a second door leaf (double doors) within this distance. 0 = off, -- click each leaf you want instead. Config.DoubleDoorDistance = 0 -- Only door-shaped objects can be selected: tall, fairly wide, but thin. -- false = allow ANY object. Config.OnlyDoors = true Config.DoorDetect = { minHeight = 1.2, -- door is at least this tall (m) maxHeight = 5.0, -- ... and at most this tall (gates, garage doors) maxThickness = 0.6, -- thinnest horizontal side must be <= this minWidth = 0.5, -- widest horizontal side range maxWidth = 5.0, } --============================================================================== -- 8 · VISUALS --============================================================================== -- ── Colours ────────────────────────────────────────────────────────────────── -- In-world colours (door outline, marker). The menus use the accent colour -- from section 1. Config.Colors = { locked = { r = 255, g = 72, b = 72 }, -- red unlocked = { r = 0, g = 255, b = 136 }, -- green accent = { r = 226, g = 182, b = 73 }, -- setup highlight } -- ── Door marker ────────────────────────────────────────────────────────────── -- A dome on configured doors, red while locked, green while unlocked. -- Off by default: the [E] prompt shows once the player is close. Config.Marker = { enabled = false, type = 28, -- 28 = dome / half-sphere distance = 12.0, -- draw within this range of a door size = vec3(0.18, 0.18, 0.18), alpha = 90, bob = false, onlyWhenLocked = false, -- true = only on locked doors } --============================================================================== -- 9 · STATIC DOORS --============================================================================== -- Most doors are created in-game with /adoorlock (stored in the database). -- You can ALSO predefine doors here; they are merged with the database doors. -- Each leaf = { model = <hash>, coords = vec3(x, y, z) } -- -- Example: -- Config.StaticDoors = { -- { -- label = 'Police Cell 1', -- locked = true, -- doors = { -- { model = `v_ilev_ph_cellgate`, coords = vec3(441.1, -998.6, 25.0) }, -- }, -- access = { -- everyone = false, -- jobs = { { name = 'police', grade = 0 } }, -- gangs = {}, -- players = {}, -- citizenids / identifiers -- items = { 'cell_key' }, -- item keys (see section 3) -- }, -- }, -- } Config.StaticDoors = {}

02SQL File

Import this SQL file into your database before starting the resource:

-- Agency Doorlock — database table (auto-created on first start, this is a manual fallback) CREATE TABLE IF NOT EXISTS `agency_doorlock` ( `id` INT NOT NULL AUTO_INCREMENT, `label` VARCHAR(64) NOT NULL DEFAULT 'Door', `locked` TINYINT(1) NOT NULL DEFAULT 1, `doors` LONGTEXT NOT NULL, `access` LONGTEXT NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Still stuck after this page? Our support team takes it from here.