Adjusted to work with RSG RedM Framework
Doors are stored in a database for ease-of-use and to allow data to be easily cleared or shared.
mysql-async is no longer supported.
- does not support error-catching (pcall)
- people use older versions which do not support parameters as arrays
- it isn't maintained and has issues that will never be resolved
ox_lib (v2.3.0 or higher)
Used for some UI elements (i.e. notifications, progress circle, input), and cache.
(Optional) Used for lockpicking.
Use the /doorlock
command to open the UI and enter the settings for your new door.
Once you confirm the settings, activate your targeting resource (typically LALT) to select the entity (or entities) to use.
Adding any arguments after the command will open the closest door to you, to easily modify it.
Placing nui_doorlock config files into the convert
folder will convert the data and insert it into the database.
Success is not guaranteed if using a fork on nui_doorlock, like the qb version.
- Use the closest door. Still performs server-side checks, so may fail.
exports.ox_doorlock:useClosestDoor()
- Pick the lock of the closest door. Still performs server-side checks, so may fail.
exports.ox_doorlock:pickClosestDoor()
- Get data for door
local mrpd_locker_rooms = exports.ox_doorlock:getDoor(1)
local mrpd_locker_rooms = exports.ox_doorlock:getDoorFromName('mrpd locker rooms')
- Set door state (0: unlocked, 1: locked)
TriggerEvent('ox_doorlock:setState', mrpd_locker_rooms.id, state)
- Listen for event when door is toggled
AddEventHandler('ox_doorlock:stateChanged', function(source, doorId, state, usedItem)
if usedItem == 'trainticket' then
local src = source
local Player = RSGCore.Functions.GetPlayer(src)
Player.Functions.RemoveItem(usedItem, 1)
end
end)
- Door name
- Used to easily identify the door.
- Passcode
- Door can be unlocked by anybody by using the code or phrase.
- Autolock interval
- Door will be locked after x seconds.
- Interact distance
- Door can only be used when within x metres.
- Door rate
- Door movement speed for sliding/garage/automatic doors, or swinging doors when locked.
- Locked
- Sets the door as locked by default.
- Double
- Door is a set of two doors, controlled together.
- Automatic
- Sliding/garage/automatic door.
- Lockpick
- Door can be lockpicked when interacting with a targeting resource.
- Hide UI
- No indicators (i.e. icon, text) will display on the door.
- Character Id
- Character identifier used by a framework (i.e. player.charid, xPlayer.identifier, Player.CitizenId).
- Group
- Framework dependent, referring to jobs, gangs, etc.
- Grade
- The minimum grade to allow access for the group (0 to allow all).
- Item
- Name of the item.
- Metadata type
- Requires metadata support (i.e. ox_inventory) to check slot.metadata.type
- Difficulty
- Sets the skillcheck difficulty (see docs).
- Area size
- Custom difficulty area size.
- Speed multiplier
- Custom difficulty idicator speed.