This commit is contained in:
Nordi98 2025-08-06 16:37:06 +02:00
parent 510e3ffcf2
commit f43cf424cf
305 changed files with 34683 additions and 0 deletions

View file

@ -0,0 +1,10 @@
---@diagnostic disable: duplicate-set-field
Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function()
return nil
end
return Doorlock

View file

@ -0,0 +1,13 @@
---@diagnostic disable: duplicate-set-field
Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle)
return true
end
return Doorlock

View file

@ -0,0 +1,12 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('doors_creator') == 'missing' then return end
Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function()
return exports["doors_creator"]:getClosestActiveDoor()
end
return Doorlock

View file

@ -0,0 +1,21 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('doors_creator') == 'missing' then return end
Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle)
local state = toggle
if state then
exports["doors_creator"]:setDoorState(doorID, 1)
else
exports["doors_creator"]:setDoorState(doorID, 0)
end
return true
end
return Doorlock

View file

@ -0,0 +1,14 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('ox_doorlock') == 'missing' then return end
Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function()
local doorData = exports.ox_doorlock:getClosestDoor()
if not doorData then return end
return tostring(doorData.id) or nil
end
return Doorlock

View file

@ -0,0 +1,20 @@
---@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
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle)
local state = toggle
if state then
exports.ox_doorlock:setDoorState(doorID, 1)
else
exports.ox_doorlock:setDoorState(doorID, 0)
end
return true
end
return Doorlock

View file

@ -0,0 +1,25 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-doorlock') == 'missing' then return end
Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function()
local closestDoor = exports["qb-doorlock"]:GetClosestDoor()
if Table.CheckPopulated(closestDoor) then return closestDoor end
local allDoors = exports["qb-doorlock"]:GetDoorList()
local pedCoords = GetEntityCoords(cache.ped)
local door = 0
local doorDist = 1000.0
for doorID, data in pairs(allDoors) do
local dist = #(pedCoords - data.objCoords)
if dist < doorDist then
door = doorID
doorDist = dist
end
end
return door
end
return Doorlock

View file

@ -0,0 +1,15 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-doorlock') == 'missing' then return end
Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle)
TriggerClientEvent('qb-doorlock:client:setState', -1, 0, doorID, toggle, false, false, false)
return true
end
return Doorlock

View file

@ -0,0 +1,23 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('rcore_doorlock') == 'missing' then return end
Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function()
local allDoors = exports.rcore_doorlock:getLoadedDoors()
local pedCoords = GetEntityCoords(cache.ped)
local door = 0
local doorDist = 1000.0
for _, data in pairs(allDoors) do
local dist = #(pedCoords - data.coords)
if dist < doorDist then
door = data.id
doorDist = dist
end
end
return door
end
return Doorlock

View file

@ -0,0 +1,19 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('rcore_doorlock') == 'missing' then return end
Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle)
local state = toggle
if state then
exports.rcore_doorlock:changeDoorState(doorID, 0)
else
exports.rcore_doorlock:changeDoorState(doorID, 1)
end
return true
end
return Doorlock