From 34bd9d0399d8f3629e036e8395c75ebfe84ec740 Mon Sep 17 00:00:00 2001 From: SumnDaiy Date: Wed, 25 Dec 2024 21:40:40 +0100 Subject: [PATCH 1/4] idk if this will work --- bridge/ox/client.lua | 32 ++++++++++++++++++++++++++++++++ bridge/ox/server.lua | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 bridge/ox/client.lua create mode 100644 bridge/ox/server.lua diff --git a/bridge/ox/client.lua b/bridge/ox/client.lua new file mode 100644 index 0000000..8ddca70 --- /dev/null +++ b/bridge/ox/client.lua @@ -0,0 +1,32 @@ +local bridge = {} +local Ox = require '@ox_core/lib/init' + +function bridge.notify(...) + lib.notify(...) +end + +function bridge.hasGroup(groups) + if not groups then return end + + local player = Ox.GetPlayer() + for i=1, #groups do + if player.getGroup(groups[i]) then + return true + end + end +end + +function bridge.getPlayer() + return Ox.GetPlayer() +end + +function bridge.doesPlayerHaveJob(player, job) + return player.getGroup[job] +end + + +AddEventHandler("ox:playerLogout", function() + TriggerEvent("ND_Police:playerUnloaded") +end) + +return bridge diff --git a/bridge/ox/server.lua b/bridge/ox/server.lua new file mode 100644 index 0000000..e914238 --- /dev/null +++ b/bridge/ox/server.lua @@ -0,0 +1,39 @@ +local bridge = {} +local Ox = require '@ox_core/lib/init' + +function bridge.notify(src, info) + local player = Ox.GetPlayer(src) + if not player then return end + TriggerClientEvent('ox_lib:notify', src, info) + -- player.notify(info) +end + +function bridge.shotSpotter(src, location, coords) + if GetResourceState("ND_MDT") ~= "started" then return end + + exports["ND_MDT"]:createDispatch({ + location = location, + callDescription = "Shotspotter detected gunshot", + coords = coords + }) +end + +function bridge.hasJobs(src, groups) + local player = Ox.GetPlayer(src) + if not player then return end + + for i=1, #groups do + if player.getGroup(groups[i]) then + return true + end + end +end + +function bridge.impoundVehicle(netId, entity, impoundReclaimPrice) + local vehicle = NDCore.getVehicle(entity) + if not vehicle then return end + vehicle.setMetadata("impoundReclaimPrice", impoundReclaimPrice) + vehicle.setStatus("impounded", true) +end + +return bridge From cf98fecc0036ece1cbf7004c74019d6064bbe7c7 Mon Sep 17 00:00:00 2001 From: SumnDaiy Date: Wed, 25 Dec 2024 22:40:40 +0100 Subject: [PATCH 2/4] Totally didn't forgot about impound --- bridge/ox/server.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bridge/ox/server.lua b/bridge/ox/server.lua index e914238..8a3bca0 100644 --- a/bridge/ox/server.lua +++ b/bridge/ox/server.lua @@ -30,10 +30,12 @@ function bridge.hasJobs(src, groups) end function bridge.impoundVehicle(netId, entity, impoundReclaimPrice) - local vehicle = NDCore.getVehicle(entity) - if not vehicle then return end - vehicle.setMetadata("impoundReclaimPrice", impoundReclaimPrice) - vehicle.setStatus("impounded", true) + local vehicle = Ox.GetVehicle(entity) + if not vehicle then + print("Didn't find vehicle") + return end + vehicle.set("impoundReclaimPrice", impoundReclaimPrice) + vehicle.setStored("impound", true) end return bridge From 93ad71a418904323be39fccbcd358dd71213a1e5 Mon Sep 17 00:00:00 2001 From: SumnDaiy Date: Wed, 25 Dec 2024 22:41:25 +0100 Subject: [PATCH 3/4] Totally didn't forget about removing the print --- bridge/ox/server.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bridge/ox/server.lua b/bridge/ox/server.lua index 8a3bca0..30f0896 100644 --- a/bridge/ox/server.lua +++ b/bridge/ox/server.lua @@ -31,9 +31,7 @@ end function bridge.impoundVehicle(netId, entity, impoundReclaimPrice) local vehicle = Ox.GetVehicle(entity) - if not vehicle then - print("Didn't find vehicle") - return end + if not vehicle then return end vehicle.set("impoundReclaimPrice", impoundReclaimPrice) vehicle.setStored("impound", true) end From 67dc16fc4face5e674cddcbb3f32d2d67080d0e9 Mon Sep 17 00:00:00 2001 From: SumnDaiy Date: Wed, 25 Dec 2024 22:55:09 +0100 Subject: [PATCH 4/4] police > lspd --- data/config.lua | 3 ++- data/locker_rooms.lua | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/data/config.lua b/data/config.lua index 303e78b..e8a3fc0 100644 --- a/data/config.lua +++ b/data/config.lua @@ -2,7 +2,8 @@ return { policeGroups = { "lspd", "sahp", - "bcso" + "bcso", + "police" -- police > lspd }, clearGSR = 15, -- time in minutes diff --git a/data/locker_rooms.lua b/data/locker_rooms.lua index 0164842..a4dc43c 100644 --- a/data/locker_rooms.lua +++ b/data/locker_rooms.lua @@ -4,29 +4,29 @@ local menus = {} menus["lspd"] = { title = "Locker room", - groups = {"lspd"}, + groups = {"lspd", "police"}, locations = { vec3(458.14, -990.82, 30.69) }, options = { { title = "Patrol uniform (long sleeve)", - groups = {"lspd"}, + groups = {"lspd", "police"}, clothing = options.lspd_patrol }, { title = "Patrol uniform (short sleeve)", - groups = {"lspd"}, + groups = {"lspd", "police"}, clothing = options.lspd_patrol2 }, { title = "Patrol uniform (vest) (long sleeve)", - groups = {"lspd"}, + groups = {"lspd", "police"}, clothing = options.lspd_patrol3 }, { title = "Patrol uniform (vest) (short sleeve)", - groups = {"lspd"}, + groups = {"lspd", "police"}, clothing = options.lspd_patrol4 }, {