Standalone
Agency-Doorlock Configuração
A forma mais simples de trancar a tua cidade.
v1.1.0Grátis5 Páginas

01Configuração
Instalação rápida · config.lua · Agency-Doorlock
-- ============================================================
-- Agency Doorlock | Config
-- ============================================================
-- Lockable doors with E & Target, easy in-game setup,
-- Job / Gang / Grade & per-player access control.
-- QB / QBox / ESX / Standalone auto-detect.
-- ------------------------------------------------------------
-- 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.
-- ============================================================
Config = {}
-- Language. Default is English. The script ships fully translated in 25 languages.
-- Add more by dropping a file into shared/locale/<code>.lua (English is the fallback).
-- Available: en de fr es it pt nl pl cs sk ro ru uk bg tr el hu hr sv da no fi ja zh ko
Config.Locale = 'en'
-- Framework: 'auto' | 'qb' | 'qbx' | 'esx' | 'standalone'
-- auto (recommended): detects QBox (qbx_core), QBCore, ESX automatically.
-- Job / Gang locks with grades are enforced on QBCore, QBox and ESX.
-- Standalone enforces "everyone" and per-player (identifier) access only.
Config.Framework = 'auto'
-- Notification system: 'agency-notify' | 'framework' | 'none'
-- agency-notify (default): https://shop.agencyg.de
-- framework: uses the QBCore / ESX built-in notification
Config.NotifySystem = 'agency-notify'
-- ============================================================
-- INTERACTION
-- ============================================================
-- How players toggle a lock: 'key' | 'target' | 'both'
-- key : press a key (Config.InteractKey) while standing at the door (uses Text UI)
-- target : ox_target / qb-target eye option
-- both : key prompt AND a target option (recommended)
Config.Interaction = 'both'
-- Key used when Interaction is 'key' or 'both' (default: E = 38)
Config.InteractKey = 38
Config.InteractKeyLabel = 'E' -- shown on the prompt keycap
-- Debug: prints access-check details to the server console (set false in production).
Config.Debug = true
-- Target system used when Interaction is 'target' or 'both': 'ox_target' | 'qb-target'
Config.TargetSystem = 'ox_target'
-- Text UI system for the [E] prompt: 'default' | 'jg-textui'
-- default : built-in 3D text drawn natively (no dependency)
-- jg-textui: https://github.com/jgscripts/jg-textui
Config.TextUISystem = 'default'
-- DEFAULT range (metres) in which a player can lock AND unlock a door. One value
-- covers both directions. This is only the default: every door can override it
-- in the /adoorlock setup menu ("Interaction range"), which is what large garage
-- doors and gates need — their centre point sits several metres from where a
-- player can actually stand. Doors without an override use the value here.
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 when the door is saved.
Config.MaxInteractDistance = 50.0
-- Global master switch for the [E] prompt HUD. Leave true normally — hiding the
-- prompt for SPECIFIC doors is done per-door in the setup UI ("Hide [E] prompt").
-- Auto-lock is also configured per-door in the setup UI.
Config.ShowPrompt = true
-- How close a door must be before the script starts drawing its prompt (perf).
Config.DrawDistance = 12.0
-- Auto-detect a second door leaf when registering (double doors). Disabled by
-- default — click each leaf you want instead. Set > 0 to re-enable auto-pairing.
Config.DoubleDoorDistance = 0
-- During setup a marker sits in front of you (where you look). Aim it at a door
-- and press [E]. Only door-shaped objects are accepted (see Config.DoorDetect).
Config.SetupRayDistance = 7.0 -- how far in front the selector reaches
-- Only allow door-like objects to be selected (not every prop). Doors are detected
-- by their shape: tall, fairly wide, but thin. Set false to allow ANY object.
Config.OnlyDoors = true
Config.DoorDetect = {
minHeight = 1.2, -- door must be at least this tall (m)
maxHeight = 5.0, -- ... and at most this tall (covers gates/garage doors)
maxThickness = 0.6, -- thinnest horizontal side must be <= this (doors are thin)
minWidth = 0.5, -- widest horizontal side range
maxWidth = 5.0,
}
-- Locking behaviour:
-- true (default): a locked door is always closed & locked (reliable).
-- false: a locked door that's open stays movable until it swings shut, then latches.
Config.LockClosesDoor = true
-- ============================================================
-- HOLD OPEN (garage doors, shutters, gates)
-- ============================================================
-- Garage doors roll shut again on their own as soon as nobody is near, which
-- makes them useless as a lockable door. With "Hold open" ticked ON A DOOR:
--
-- unlocked -> the gate opens and STAYS open, by itself
-- locked -> the gate closes and locks, as normal
--
-- This is a PER-DOOR setting — tick "Hold open" in the /adoorlock setup UI for
-- the gates that need it. Every other door behaves exactly as before.
--
-- How far the gate travels while held open. 1.0 = fully open (default). 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 script to keep re-applying the hold. The
-- game rolls these doors shut again 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
-- Play the native GTA door lock/unlock sound on toggle (heard by players near the door).
-- Loud, clearly audible GTA options (swap name/set as you like):
-- { name='Remote_Control_Fob', set='PI_Menu_Sounds' } -- GTA door/vehicle lock (loud) [default]
-- { name='Lock'/'Unlock', set='CELLPHONE_SOUNDSET' } -- subtle phone-lock click (quiet)
-- { name='SELECT', set='HUD_FRONTEND_DEFAULT_SOUNDSET' } -- menu beep
Config.PlaySound = true
-- Native sound DISABLED — the real door sound (html/door-bolt-4.ogg, same as qb-doorlock)
-- is played through the NUI. (Remote_Control_Fob was the car-key/fob beep — removed.)
Config.Sounds = {}
-- Lock / unlock animation played on the player who toggles the door.
-- A short forward hand-reach (works without a prop). Swap dict/name for any anim.
Config.Animation = {
enabled = true,
dict = 'anim@heists@keycard@',
name = 'exit',
duration = 1100, -- ms
}
-- ============================================================
-- SETUP / PERMISSIONS
-- ============================================================
-- Command to open the in-game door setup mode (aim at a door -> add -> configure).
Config.SetupCommand = 'adoorlock'
-- Short alias for the setup command (leave '' to disable). Default: /adl
Config.SetupCommandAlias = 'adl'
-- Who may open the setup mode and create / delete doors.
-- 'ace' : requires the ACE permission Config.SetupAce (server-sided, secure)
-- 'admin' : requires QBCore/ESX admin/god (or ace 'command' as fallback)
-- 'job' : requires 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)
-- ============================================================
-- VISUALS
-- ============================================================
Config.Colors = {
locked = { r = 255, g = 72, b = 72 }, -- red
unlocked = { r = 0, g = 255, b = 136 }, -- green
accent = { r = 0, g = 212, b = 255 }, -- cyan (setup highlight)
}
-- Marker shown on configured doors (the red/green dome). Helps players spot
-- lockable doors. Coloured red while locked, green while unlocked.
Config.Marker = {
enabled = false, -- no dots on doors (the nice [E] prompt shows when close)
type = 28, -- 28 = dome/half-sphere
distance = 12.0, -- draw the marker permanently within this range of a door
size = vec3(0.18, 0.18, 0.18), -- small & unobtrusive
alpha = 90,
bob = false,
onlyWhenLocked = false, -- true = only show the marker on locked doors
}
-- ============================================================
-- STATIC DOORS (optional)
-- ============================================================
-- Most doors should be created in-game with /doorlock (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 = {}, -- list of citizenids / identifiers
-- },
-- },
-- }
Config.StaticDoors = {}
-- ============================================================
-- AGENCY COMPANION APP (free iOS / Android remote control)
-- ============================================================
-- Links your doors to the free Agency Companion app via the Agency relay so
-- players can lock/unlock doors they have access to from their phone, and admins
-- can override or delete any door remotely — with its OWN QR code, fully
-- independent of Agency-Phone / Agency-Elevator.
-- • Players: /adlconnect (alias /adlc) pulls up a pairing QR anyone can scan.
-- • Admins: the QR also lives inside the /adoorlock setup menu.
-- The pairing token can NEVER grant admin — every admin action re-checks rights.
--
-- This whole block is OPTIONAL. If you remove it (or an older config.lua doesn't
-- have it) the companion stays ENABLED with the defaults below — so a stale
-- config can never silently kill the feature. Set Enable = false to opt out.
Config.Companion = {
Enable = true, -- master switch for the companion integration
EnableRemote = true, -- dial out to the relay (false = QR shows but no remote control)
RelayUrl = 'https://api.agencyg.de', -- Agency relay endpoint (leave as-is unless self-hosting)
TokenTTL = 300, -- seconds a pairing QR / 6-digit code stays valid
-- How close (metres) a player must be to a door to lock/unlock it from the
-- app. Admins bypass this (they can override any door from anywhere).
ToggleDistance = 20.0,
}
02Arquivo SQL
Importe este arquivo SQL no seu banco de dados antes de iniciar o recurso:
-- 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;