Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ox_core bridge #27

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions bridge/ox/client.lua
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions bridge/ox/server.lua
Original file line number Diff line number Diff line change
@@ -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 = Ox.GetVehicle(entity)
if not vehicle then return end
vehicle.set("impoundReclaimPrice", impoundReclaimPrice)
vehicle.setStored("impound", true)
end

return bridge
3 changes: 2 additions & 1 deletion data/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ return {
policeGroups = {
"lspd",
"sahp",
"bcso"
"bcso",
"police" -- police > lspd
},

clearGSR = 15, -- time in minutes
Expand Down
10 changes: 5 additions & 5 deletions data/locker_rooms.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
{
Expand Down