mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 22:36:03 +01:00
Fixed issue where unauthorized jobs could open the door.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
||||||
|
local hasAccess = false
|
||||||
|
|
||||||
function drawText3D(coords, text)
|
function drawText3D(coords, text)
|
||||||
local onScreen, _x, _y = World3dToScreen2d(coords.x, coords.y, coords.z + 0.5)
|
local onScreen, _x, _y = World3dToScreen2d(coords.x, coords.y, coords.z + 0.5)
|
||||||
@@ -51,16 +52,21 @@ end)
|
|||||||
Citizen.CreateThread(function()
|
Citizen.CreateThread(function()
|
||||||
while true do
|
while true do
|
||||||
for doorID, door in pairs(doorList) do
|
for doorID, door in pairs(doorList) do
|
||||||
if #(pedCoords - door.textCoords) < door.accessDistance and isAuthorized(door) then
|
if #(pedCoords - door.textCoords) < door.accessDistance then
|
||||||
drawText3D(door.textCoords, getDoorText(door.locked))
|
hasAccess = isAuthorized(door)
|
||||||
|
if hasAccess then
|
||||||
|
drawText3D(door.textCoords, getDoorText(door.locked))
|
||||||
|
end
|
||||||
for _, doors in pairs(door.doors) do
|
for _, doors in pairs(door.doors) do
|
||||||
local entity = GetClosestObjectOfType(doors.coords.x, doors.coords.y, doors.coords.z, 1.0, doors.hash, false, false, false)
|
local entity = GetClosestObjectOfType(doors.coords.x, doors.coords.y, doors.coords.z, 1.0, doors.hash, false, false, false)
|
||||||
FreezeEntityPosition(entity, door.locked)
|
FreezeEntityPosition(entity, door.locked)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if IsControlJustPressed(0, 51) then
|
if IsControlJustPressed(0, 51) then
|
||||||
door.locked = not door.locked
|
if hasAccess then
|
||||||
TriggerServerEvent("ND_Doorlocks:syncDoor", doorID, door.locked)
|
door.locked = not door.locked
|
||||||
|
TriggerServerEvent("ND_Doorlocks:syncDoor", doorID, door.locked)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Citizen.Wait(0)
|
Citizen.Wait(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user