Files
community_bridge/modules/Doorlock/qb-doorlock/client.lua
T
MrNewb 92f6d42555 0.0.10
Aligned folder names with table names for most parts. Temporarily removed unfinished ox_core compatibility. Added missing tables to init.lua, updated manifest to reflect new folder names, and incremented version number.
2025-01-09 03:55:10 -05:00

20 lines
623 B
Lua

if GetResourceState('qb-doorlock') ~= 'started' then return end
Doorlock = {}
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