mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
Delete ND_Doorlocks directory
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
|
||||||
|
|
||||||
doorList = {
|
|
||||||
-- Sandy Shores Sheriff office front door.
|
|
||||||
{
|
|
||||||
textCoords = vector3(1855.1896, 3683.4507, 34.2675),
|
|
||||||
authorizedJobs = {"BCSO", "LSPD", "BCSO"},
|
|
||||||
locked = true,
|
|
||||||
accessDistance = 1.5,
|
|
||||||
doors = {
|
|
||||||
{hash = -1765048490, coords = vector3(1855.4108, 3683.3062, 34.2675), heading = 29.9}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Paleto bay Sheriff office office front doors.
|
|
||||||
{
|
|
||||||
textCoords = vector3(-443.6129, 6016.0483, 31.7164),
|
|
||||||
authorizedJobs = {"BCSO", "LSPD", "BCSO"},
|
|
||||||
locked = true,
|
|
||||||
accessDistance = 1.5,
|
|
||||||
doors = {
|
|
||||||
{hash = -1501157055, coords = vector3(-443.1538, 6015.5649, 31.7164), heading = 315.0},
|
|
||||||
{hash = -1501157055, coords = vector3(-444.1442, 6016.6621, 31.7164), heading = 135.0}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Mission Row Police Station front doors.
|
|
||||||
{
|
|
||||||
textCoords = vector3(434.7345, -981.9468, 30.7102),
|
|
||||||
authorizedJobs = {"BCSO", "LSPD", "BCSO"},
|
|
||||||
locked = true,
|
|
||||||
accessDistance = 1.5,
|
|
||||||
doors = {
|
|
||||||
{hash = -1215222675, coords = vector3(434.8228, -981.1198, 30.6896), heading = 268.0},
|
|
||||||
{hash = 320433149, coords = vector3(434.8228, -982.7103, 30.6896), heading = 272.0}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
|
||||||
|
|
||||||
author "Andyyy#7666, N1K0#0001"
|
|
||||||
description "ND Framework Doorlocks for buildings"
|
|
||||||
version "2.1.0"
|
|
||||||
|
|
||||||
fx_version "cerulean"
|
|
||||||
game "gta5"
|
|
||||||
lua54 "yes"
|
|
||||||
|
|
||||||
client_scripts {
|
|
||||||
"config.lua",
|
|
||||||
"source/client.lua"
|
|
||||||
}
|
|
||||||
server_script "source/server.lua"
|
|
||||||
|
|
||||||
dependency "ND_Core"
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
|
||||||
|
|
||||||
NDCore = exports["ND_Core"]:GetCoreObject()
|
|
||||||
local job = nil
|
|
||||||
local hasAccess = false
|
|
||||||
|
|
||||||
function drawText3D(coords, text)
|
|
||||||
local onScreen, _x, _y = World3dToScreen2d(coords.x, coords.y, coords.z + 0.5)
|
|
||||||
local pX, pY, pZ = table.unpack(GetGameplayCamCoords())
|
|
||||||
SetTextScale(0.4, 0.4)
|
|
||||||
SetTextFont(4)
|
|
||||||
SetTextProportional(1)
|
|
||||||
SetTextEntry("STRING")
|
|
||||||
SetTextCentre(true)
|
|
||||||
SetTextColour(255, 255, 255, 255)
|
|
||||||
SetTextOutline()
|
|
||||||
AddTextComponentString(text)
|
|
||||||
DrawText(_x, _y)
|
|
||||||
end
|
|
||||||
|
|
||||||
function getDoorText(locked)
|
|
||||||
if locked then
|
|
||||||
if hasAccess then
|
|
||||||
return "Locked [E]"
|
|
||||||
else
|
|
||||||
return "Locked"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if hasAccess then
|
|
||||||
return "Unlocked [E]"
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function isAuthorized(door)
|
|
||||||
for _, authorizedJob in pairs(door.authorizedJobs) do
|
|
||||||
if job == authorizedJob then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
RegisterNetEvent("ND:setCharacter", function(character)
|
|
||||||
job = character.job
|
|
||||||
end)
|
|
||||||
|
|
||||||
AddEventHandler("playerSpawned", function()
|
|
||||||
TriggerServerEvent("ND_Doorlocks:getDoors")
|
|
||||||
end)
|
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
|
||||||
while true do
|
|
||||||
pedCoords = GetEntityCoords(PlayerPedId())
|
|
||||||
Citizen.Wait(1000)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
|
||||||
while true do
|
|
||||||
for doorID, door in pairs(doorList) do
|
|
||||||
if #(pedCoords - door.textCoords) < door.accessDistance then
|
|
||||||
hasAccess = isAuthorized(door)
|
|
||||||
drawText3D(door.textCoords, getDoorText(door.locked))
|
|
||||||
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)
|
|
||||||
FreezeEntityPosition(entity, door.locked)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if IsControlJustPressed(0, 51) then
|
|
||||||
if hasAccess then
|
|
||||||
door.locked = not door.locked
|
|
||||||
TriggerServerEvent("ND_Doorlocks:syncDoor", doorID, door.locked)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Citizen.Wait(0)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent("ND_Doorlocks:syncDoor", function(doorID, state)
|
|
||||||
doorList[doorID].locked = state
|
|
||||||
for _, doors in pairs(doorList[doorID].doors) do
|
|
||||||
local entity = GetClosestObjectOfType(doors.coords.x, doors.coords.y, doors.coords.z, 1.0, doors.hash, false, false, false)
|
|
||||||
SetEntityHeading(entity, doors.heading)
|
|
||||||
FreezeEntityPosition(entity, state)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent("ND_Doorlocks:returnDoors", function(updatedDoors)
|
|
||||||
for doorID, state in pairs(updatedDoors) do
|
|
||||||
doorList[doorID].locked = state
|
|
||||||
for _, doors in pairs(doorList[doorID].doors) do
|
|
||||||
local entity = GetClosestObjectOfType(doors.coords.x, doors.coords.y, doors.coords.z, 1.0, doors.hash, false, false, false)
|
|
||||||
SetEntityHeading(entity, doors.heading)
|
|
||||||
FreezeEntityPosition(entity, state)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
|
|
||||||
|
|
||||||
NDCore = exports["ND_Core"]:GetCoreObject()
|
|
||||||
NDCore.Functions.VersionChecker("ND_Doorlocks", GetCurrentResourceName(), "https://github.com/Andyyy7666/ND_Framework", "https://raw.githubusercontent.com/Andyyy7666/ND_Framework/main/ND_Doorlocks/fxmanifest.lua")
|
|
||||||
|
|
||||||
local updatedDoors = {}
|
|
||||||
|
|
||||||
RegisterNetEvent("ND_Doorlocks:syncDoor", function(doorID, state)
|
|
||||||
updatedDoors[doorID] = state
|
|
||||||
TriggerClientEvent("ND_Doorlocks:syncDoor", -1, doorID, state)
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent("ND_Doorlocks:getDoors", function()
|
|
||||||
local player = source
|
|
||||||
TriggerClientEvent("ND_Doorlocks:returnDoors", player, updatedDoors)
|
|
||||||
end)
|
|
||||||
Reference in New Issue
Block a user