Files
community_bridge/modules/doorlock/ox_doorlock/server.lua
T
MrNewb 90c65dc55e Add GetResourceName function to all modules
Introduces a standardized GetResourceName function to banking, clothing, dispatch, doorlock, framework, fuel, helptext, housing, and other modules. This function returns the name of the in-use resource, improving resource identification and interoperability across the codebase.
2025-09-10 12:27:12 -04:00

29 lines
726 B
Lua

---@diagnostic disable: duplicate-set-field
if GetResourceState('ox_doorlock') == 'missing' then return end
Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string|number
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle)
if type(doorID) == 'string' then
doorID = tonumber(doorID)
end
local state = toggle
if state then
exports.ox_doorlock:setDoorState(doorID, 1)
else
exports.ox_doorlock:setDoorState(doorID, 0)
end
return true
end
---This will get the name of the in use resource.
---@return string
Doorlock.GetResourceName = function()
return 'ox_doorlock'
end
return Doorlock