Skip to content

Commit

Permalink
uploaded MDT
Browse files Browse the repository at this point in the history
  • Loading branch information
BubbleDK committed Aug 21, 2024
1 parent c2c8ec9 commit ffb5ba4
Show file tree
Hide file tree
Showing 192 changed files with 18,734 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<h4 style="text-align: center;">This is still relatively untested, and bugs are likely to occur. You should only use this if you're comfortable with programming and fixing the bugs yourself. I will provide limited support and cannot guarantee that any bugs or issues will be fixed within a typical timeframe.</h4>

<img src="https://r2.fivemanage.com/s64hZD0G9WtYHbURWCuSc/5106eb971eee6ed4dd8d5e9196ccf9fe.png" alt="bub-mdt-image" />

You can watch a preview [here](https://streamable.com/m91u9u)

# Bubble MDT & Dispatch

A police MDT with built-in dispatch functionalities. The MDT consists of the following pages:

- Dashboard
- Profiles
- Incidents
- Reports
- Vehicles
- Dispatch
- Roster
- Charges

# Frameworks

- [qbx_core](https://github.com/Qbox-project/qbx_core)

# Dependencies

- [oxmysql](https://github.com/overextended/oxmysql)
- [ox_lib](https://github.com/overextended/ox_lib)

# Installation

- Install all the dependencies and have them started before bub-mdt
- Import the SQL provided
- Drag and drop the resource into your resources folder
- Add `start bub-mdt` to your `server.cfg` file

# Credits

Without the creation of the following resources, this MDT would not have seen the light of day, as this MDT is heavily inspired by these:

- [ox_mdt](https://github.com/overextended/ox_mdt) - Dispatch, Some events and function, Code structure and data flow

# Feature Request, Issue Reporting & Contribution

- Contributions are always welcome - Open a pull request.
- Found a bug? Open an issue.
- Want a feature implemented? Open an issue.

# The resource state

- LUA part needs some refactoring.
- A lot of the UI needs to be refactored, more modular and simply be optimized.
- The drivers license points system needs to be revamped, as of right now it does not function properly.
- Probably a lot more which i have forgotten about, but i guess it will get mentioned if people end up using this MDT.
250 changes: 250 additions & 0 deletions client/alerts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
local config = require 'config'
local framework = require(('client.framework.%s'):format(config.framework))
local utils = require 'client.utils'

local function CustomAlert(data)
local coords = data.coords
local disptachInfo = {}

for i = 1, #data.info do
disptachInfo[#disptachInfo+1] = {
label = data.info[i].label,
icon = data.info[i].icon
}
end

local dispatchData = {
code = data.code or '10-80',
offense = data.offense,
coords = {
coords.x,
coords.y
},
info = disptachInfo,
blip = data.blip or 162,
isEmergency = data.isEmergency or false,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('CustomAlert', CustomAlert)

local function VehicleTheft()
local coords = GetEntityCoords(cache.ped)
local closestVehicle = lib.getClosestVehicle(GetEntityCoords(cache.ped))

local dispatchData = {
code = '10-35',
offense = "Vehicle Theft",
coords = {
coords.x,
coords.y
},
info = {
{
label = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(closestVehicle))),
icon = 'car',
},
{
label = GetVehicleNumberPlateText(closestVehicle),
icon = 'badge-tm',
},
{
label = utils.GetVehicleColor(closestVehicle),
icon = 'palette'
}
},
blip = 67,
isEmergency = false,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('VehicleTheft', VehicleTheft)

local function Shooting()
local coords = GetEntityCoords(cache.ped)

local dispatchData = {
code = '10-11',
offense = "Shooting in progress",
coords = {
coords.x,
coords.y
},
info = {
{
label = utils.GetWeaponName(),
icon = 'gun',
},
{
label = framework.getPlayerGender(),
icon = 'gender-bigender',
}
},
blip = 60,
isEmergency = false,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('Shooting', Shooting)

local function VehicleShooting()
local coords = GetEntityCoords(cache.ped)

local dispatchData = {
code = '10-60',
offense = "Shots Fired from Vehicle",
coords = {
coords.x,
coords.y
},
info = {
{
label = utils.GetWeaponName(),
icon = 'gun',
},
{
label = framework.getPlayerGender(),
icon = 'gender-bigender',
},
{
label = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(cache.vehicle))),
icon = 'car',
},
{
label = GetVehicleNumberPlateText(cache.vehicle),
icon = 'badge-tm',
},
{
label = utils.GetVehicleColor(cache.vehicle),
icon = 'palette'
}
},
blip = 60,
isEmergency = false,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('VehicleShooting', VehicleShooting)

local function SpeedingVehicle()
local coords = GetEntityCoords(cache.ped)

local dispatchData = {
code = '10-11',
offense = "Reckless driving",
coords = {
coords.x,
coords.y
},
info = {
{
label = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(cache.vehicle))),
icon = 'car',
},
{
label = GetVehicleNumberPlateText(cache.vehicle),
icon = 'badge-tm',
},
{
label = utils.GetVehicleColor(cache.vehicle),
icon = 'palette'
}
},
blip = 162,
isEmergency = false,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('SpeedingVehicle', SpeedingVehicle)

local function CarJacking(vehicle)
local coords = GetEntityCoords(cache.ped)

local dispatchData = {
code = '10-35',
offense = "Car Jacking",
coords = {
coords.x,
coords.y
},
info = {
{
label = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))),
icon = 'car',
},
{
label = GetVehicleNumberPlateText(vehicle),
icon = 'badge-tm',
},
{
label = utils.GetVehicleColor(vehicle),
icon = 'palette'
}
},
blip = 67,
isEmergency = false,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('CarJacking', CarJacking)

local function OfficerDown()
local coords = GetEntityCoords(cache.ped)

local dispatchData = {
code = '10-99',
offense = "Officer Down",
coords = {
coords.x,
coords.y
},
info = {
{
label = framework.getPlayerGender(),
icon = 'gender-bigender',
},
},
blip = 310,
isEmergency = true,
blipCoords = coords,
}

TriggerServerEvent('mdt:server:CreateCall', dispatchData)
end
exports('OfficerDown', OfficerDown)
RegisterNetEvent("mdt:client:officerdown", OfficerDown)

RegisterCommand('testcall', function()
local random = math.random(1, 3)

if random == 1 then
OfficerDown()
elseif random == 2 then
Shooting()
else
CustomAlert({
coords = vec3(0, 0, 0),
info = {
{
label = framework.getPlayerGender(),
icon = 'gender-bigender',
},
},
code = '10-90',
offense = 'A cool offense',
blip = 310,
})
end
end)
35 changes: 35 additions & 0 deletions client/blips.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
RegisterNetEvent('mdt:addBlip', function(data)
local street1, street2 = GetStreetNameAtCoord(data.blipCoords.x, data.blipCoords.y, data.blipCoords.z)
local street1name = GetStreetNameFromHashKey(street1)
local street2name = GetStreetNameFromHashKey(street2)
local transG = 250
local blip = AddBlipForCoord(data.blipCoords.x, data.blipCoords.y, data.blipCoords.z)
local blip2 = AddBlipForCoord(data.blipCoords.x, data.blipCoords.y, data.blipCoords.z)

SetBlipSprite(blip, 60)
SetBlipSprite(blip2, 161)
SetBlipColour(blip, 38)
SetBlipColour(blip2, 38)
SetBlipDisplay(blip, 4)
SetBlipDisplay(blip2, 8)
SetBlipAlpha(blip, transG)
SetBlipAlpha(blip2, transG)
SetBlipScale(blip, 0.8)
SetBlipScale(blip2, 2.0)
SetBlipAsShortRange(blip, false)
SetBlipAsShortRange(blip2, false)
PulseBlip(blip2)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(data.text)
EndTextCommandSetBlipName(blip)
while transG ~= 0 do
Wait(180 * 4)
transG = transG - 1
SetBlipAlpha(blip, transG)
SetBlipAlpha(blip2, transG)
if transG == 0 then
RemoveBlip(blip)
return
end
end
end)
Loading

0 comments on commit ffb5ba4

Please sign in to comment.