[VORP] GS_DOORLOCKS | Double & Single Doors | Create & Edit

An easy feature packed doorlock system for VORP/RedM.

No “hash list” involved, as long as the door works within game, this resource will get that information for you upon creating the door.

Features

  • Easily create, edit and delete doors
  • Supports single and double doors
  • Updates all clients without needing to relog or restart resources.
  • Persistent via database
  • Character permissions, and/or job permissions
  • Show/Hide UIPrompts and/or sprite
  • Enable/Disable lockpicking per door
  • Enable/Disable whether or not door is automatically locked on startup
  • Server-Side & Client-Side API that can be used in other resources
  • Locale (English is already included, feel free to translate and do a PR)
  • 0.0 Resmon idle and ~0.04 when UIPromts are displayed

Commands

/createdoor - Create a new door

  • Create single & double doors
  • Control what jobs can access the lock
  • Control what characters via their character Identifier can access the lock
  • Name your locks with custom names (which can be be used to grab locks via api)
  • Enable/Disable the UIPrompt for the lock (You can use the /togglelock command to still toggle the door lock)
  • Enable/Disable whether or not the door is locked automatically on startup
  • Enable/Disable whether or not the lock can be lockpicked (with item configured)

/editdoor - Edit the closest door

  • Change the door’s name
  • Edit job permissions
  • Edit character permissions
  • Enable/Disable the UIPrompt for the lock (You can use the /togglelock command to still toggle the door lock)
  • Enable/Disable whether or not the door is locked automatically on startup
  • Enable/Disable whether or not the lock can be lockpicked (with item configured)
  • Delete the door

/togglelock - Toggle the closest doorlock (Also works when UIPrompts are hidden)

Video Examples

Create Double Door
Create Single Door
Edit Door
UIPrompt Interactions
Lockpick Door
ToogleLock Command

API

Client Side

CreateDoor | Opens the “create door” menu and returns the door ID when completed or nil when canceled

exports.gs_doorlocks:CreateDoor()

GetDoorId | Returns the door id or nil if canceled (works great for existing doors that have already been created)

exports.gs_doorlocks:GetDoorId()

ClosestDoor | Returns the closest door or nil if none

exports.gs_doorlocks:ClosestDoor()

Server Side

GetAPI | Returns the doorlock class containing functions to easily update door locks

local DoorLocks = exports.gs_doorlocks:GetAPI()

There’s various class functions to update locks


local DoorLocks = exports.gs_doorlocks:GetAPI()
local Door = DoorLocks:Door(id:int)

Door.fn.SetLock(true|false) -- Lock/Unlock Door
Door.fn.SetName(name:str) -- Set the locks name
Door.fn.SetLockOnStart(true|false) -- Enable/Disable automatic lock on startup
Door.fn.SetCanLockpick(true|false) -- Enable/Disable lockpick functionality
Door.fn.ShowUIPrompt(true|false) -- Enable/Disable UIPrompt when player is within range

-- Job Access / Permissions

Door.fn.SetJobAccess(access:table) -- Replaces the job access table. Eg. {'name1', 'name2', ...}
Door.fn.AddJob(name:str) -- Add a job name to existing table
Door.fn.RemoveJob(name:str) -- Remove a job name from existing table

-- Character Access / Permissions

Door.fn.SetCharAccess(access:table) -- Replaces the character access table. Eg. {1, 4, 2, ...}
Door.fn.AddChar(characterIdenntifer:int) -- Add a character to existing table
Door.fn.RemoveChar(characterIdenntifer:int) -- Remove a character from existing table

All updates and changes are updated too all clients in real time (no need to relog)

Dependencies

While this resource was built around VORP it could be modified for any framework.

Todo

Add time based locks (Lock/Unlock doors based on time of day)
Auto lock (maybe)

I’m always open to cool ideas that will benefit everyone. I’m not perfect, if there’s a bug please report it or open a PR.

Download

Other Resources

[VORP] Moonshining

Code is accessible Yes
Subscription-based No
Lines (approximately) ~2000
Requirements VORP Core, VORP Inventory, VORP Menu, VORP Inputs
Support Yes
(For releases without code the not applicable fields can be written as N/A)
6 Likes

Updated v1.0.3

  • Added new exports to get a door class not just by ID but by name and hash
  • Triggers done via api will no longer update all clients unless an actual change was made. Will help with batch updates without impacting client performance
  • Added the ability to disable UIPrompts entirely in exchange for a simple button press instead
  • Changed targeting when creating a door to raycast (This will ensure door entities are properly detected)
  • Hide radar while menu is open
  • Now supports gates
1 Like

Updated v1.0.4

  • Added the ability to control job name and rank per door
  • Added the ability to set a required item per door
  • Added the ability to enable/disable law enforcement notifications per door when lock picked
  • Added lockpick notifications for law enforcement based on distance and job names
    • Edit the notification and blip settings
  • Added the ability to manually add doors via the config which will be created/updated on startup
  • Added server-side(only) api to add doors from other resources
  • Some minor improvements/QoL changes
1 Like

Updated v1.0.5

  • Added server side api to update existing doors during runtime via other resources using a single call

    • Change name
    • Set lock status
    • Enable/Disable lockpicking
    • Enable/Disable prompt
    • Update doors coords
    • Update job access
    • Update character access
  • Some QoL changes