Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mythicframework.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

The Doors component manages door lock states, elevator floor access, lockpicking, and dynamic door creation.

Overview

Access via Doors (server-side only).

Lock Control

Lock and unlock doors

Elevators

Multi-floor elevator management

Dynamic Doors

Runtime door creation

Lockpicking

Lockpick support
Server-Side Only: Door state changes must be performed on the server. Changes are automatically broadcast to all clients.

Door Methods

Doors:SetLock

Set the lock state of a door.
Doors:SetLock(doorId, newState, doneDouble)
doorId
string|number
required
Door string ID or numeric index
newState
boolean|nil
required
true = locked, false = unlocked, nil = toggle
doneDouble
boolean
Internal flag for double-door handling (do not set manually)
state
boolean|nil
New lock state, or nil if door not found
Behavior:
  • If the door has a double property, both doors are updated
  • If the door has autoLock, it will re-lock after the specified seconds
  • Broadcasts Doors:Client:UpdateState to all clients
Example:
-- Lock a door
Doors:SetLock('mrpd_front', true)

-- Unlock a door
Doors:SetLock('mrpd_front', false)

-- Toggle a door
Doors:SetLock('mrpd_front', nil)

-- Lock door after a robbery
AddEventHandler('mythic-robbery:server:Started', function(source, robberyId, doorId)
    Doors:SetLock(doorId, true)
end)

Doors:IsLocked

Check if a door is currently locked.
Doors:IsLocked(doorId)
doorId
string|number
required
Door string ID or numeric index
locked
boolean
true if locked
Example:
if Doors:IsLocked('mrpd_front') then
    TriggerClientEvent('mythic-notifications:client:Send', source, {
        message = 'This door is locked',
        type = 'error'
    })
end

Doors:SetForcedOpen

Force a door to open visually (e.g., after breaching).
Doors:SetForcedOpen(doorId)
doorId
string|number
required
Door string ID or numeric index
Example:
-- Breach a door
Doors:SetLock(doorId, false)
Doors:SetForcedOpen(doorId)

Doors:SetElevatorLock

Set the lock state of an elevator floor.
Doors:SetElevatorLock(elevatorId, floorId, newState)
elevatorId
string
required
Elevator identifier
floorId
number
required
Floor index
newState
boolean|nil
required
true = locked, false = unlocked, nil = toggle
state
boolean|nil
New lock state, or nil if not found
Example:
-- Lock the top floor of MRPD elevator
Doors:SetElevatorLock('mrpd_elevator', 3, true)

Dynamic Door Exports

These are resource exports (not component methods) for runtime door management.

GetAllDoors

exports['mythic-doors']:GetAllDoors()
doors
table
All door definitions

AddDynamicDoor

Add a door at runtime (saved to database).
exports['mythic-doors']:AddDynamicDoor(doorData)
doorData
table
required
Door definition (see Configuration page)

RemoveDynamicDoor

Remove a dynamic door.
exports['mythic-doors']:RemoveDynamicDoor(doorIndex)

UpdateDynamicDoor

Update an existing dynamic door.
exports['mythic-doors']:UpdateDynamicDoor(doorIndex, doorData)

GetAllElevators

exports['mythic-doors']:GetAllElevators()

AddDynamicElevator

exports['mythic-doors']:AddDynamicElevator(data)

UpdateDynamicElevator

exports['mythic-doors']:UpdateDynamicElevator(elevatorIndex, data)

RemoveDynamicElevator

exports['mythic-doors']:RemoveDynamicElevator(elevatorIndex)

Server Callbacks

CallbackDescription
Doors:FetchReturns all door and elevator data + configs
Doors:ToggleLocksToggle a door lock (checks authorization)
Doors:LockpickAttempt to lockpick a door
Doors:Elevators:ToggleLocksToggle elevator floor lock
Doors:Elevator:ValidateValidate elevator usage

Events

EventDirectionDescription
Doors:Client:UpdateStateServer → ClientDoor lock state changed
Doors:Client:SetForcedOpenServer → ClientDoor forced open
Doors:Client:UpdateElevatorStateServer → ClientElevator floor lock changed
Doors:Client:AttemptLockpickServer → ClientStart lockpick minigame
Doors:Server:LockpickFailedClient → ServerLockpick attempt failed

Best Practices

-- ✅ Good: Named door, easy to reference
{ id = "mrpd_front", model = 2089009131, coords = vector3(...), locked = true }

-- ❌ Bad: No ID, must use numeric index
{ model = 2089009131, coords = vector3(...), locked = true }
-- Check if a door is accessible before allowing entry
if Doors:IsLocked('vault_door') then
    TriggerClientEvent('mythic-notifications:client:Send', source, {
        message = 'The vault is locked',
        type = 'error'
    })
    return
end

Next Steps

Doors - Configuration

Door and elevator definitions

Jobs API

Job restrictions for doors

Admin Callbacks

Admin door management tools