Skip to content

Commit

Permalink
Merge branch 'Project-Sloth:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nggcasey authored Jun 12, 2022
2 parents 7b8e424 + 52e3e62 commit a311296
Show file tree
Hide file tree
Showing 23 changed files with 286 additions and 129 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# Beta Released
# Project Sloth MDT

For all support questions, ask in our Discord support chat. Do not create issues if you need help. Issues are for bug reporting and new features only.

https://www.discord.gg/projectsloth

## Dependencies

- QBCore
- OxMySQL V1.9.0 (will release docs on how to use an older version)

## EchoRP MDT QBCore Edit (WIP)

EchoRP MDT Released by Flawws#9999 from Echo RP rewritten and restructured for QBCore.
This is no longer a fork so we are able to open issues on this repo.
- [QBCore](https://github.com/qbcore-framework/qb-core)
- [PS-Dispatch](https://github.com/Project-Sloth/ps-dispatch)
- [Ox MySQL](https://github.com/overextended/oxmysql)

## FAQ
- **How do I add charges to a criminal in an Incident?** - After finding and adding the criminal citizen to the incident, right-click in the space under the criminal's name and select "Add Charge".

![](https://i.imgur.com/WVEDLnJ.png)

## EchoRP MDT QBCore Edit (WIP)

EchoRP MDT Released by Flawws#9999 from Echo RP rewritten and restructured for QBCore.
This is no longer a fork so we are able to open issues on this repo.

# DMCA Protection Certificate
![image](https://user-images.githubusercontent.com/82112471/169714767-ac9aef04-e4b0-4144-840c-5453dcb05e01.png)

Expand Down
10 changes: 10 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,11 @@ RegisterNUICallback("callDetach", function(data, cb)
cb(true)
end)

RegisterNUICallback("removeCallBlip", function(data, cb)
TriggerEvent('ps-dispatch:client:removeCallBlip', data.callid)
cb(true)
end)

RegisterNUICallback("callAttach", function(data, cb)
TriggerServerEvent('mdt:server:callAttach', data.callid)
cb(true)
Expand Down Expand Up @@ -824,6 +829,11 @@ RegisterNUICallback("statusImpound", function(data, cb)
cb('ok')
end)

RegisterNUICallback('openCamera', function(data)
local camId = tonumber(data.cam)
TriggerEvent('police:client:ActiveCamera', camId)
end)

RegisterNetEvent('mdt:client:attachedUnits', function(sentData, callid)
SendNUIMessage({ type = "attachedUnits", data = sentData, callid = callid })
end)
Expand Down
10 changes: 2 additions & 8 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ client_scripts{
ui_page 'ui/dashboard.html'

files {
'ui/img/sasp_badge.png',
'ui/img/ems_badge.png',
'ui/img/court.png',
'ui/img/warrant_pfp.png',
'ui/img/profile_pic.png',
'ui/img/not-found.jpg',
'ui/img/male.png',
'ui/img/female.png',
'ui/img/*.png',
'ui/img/*.webp',
'ui/dashboard.html',
'ui/dmv.html',
'ui/bolos.html',
Expand Down
21 changes: 18 additions & 3 deletions server/dbm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function GetPlayerDataById(id)
else
return MySQL.single.await('SELECT citizenid, charinfo, job, metadata FROM players WHERE citizenid = ? LIMIT 1', { id })
end

-- return exports.oxmysql:executeSync('SELECT citizenid, charinfo, job FROM players WHERE citizenid = ? LIMIT 1', { id })
end

Expand Down Expand Up @@ -127,6 +127,13 @@ function GetPlayerLicenses(identifier)
local metadata = json.decode(result)
if metadata["licences"] ~= nil and metadata["licences"] then
return metadata["licences"]
else
return {
['driver'] = false,
['business'] = false,
['weapon'] = false,
['pilot'] = false
}
end
end
end
Expand Down Expand Up @@ -157,11 +164,19 @@ function ManageLicenses(identifier, incomingLicenses)
local Player = QBCore.Functions.GetPlayerByCitizenId(identifier)
if Player ~= nil then
Player.Functions.SetMetaData("licences", incomingLicenses)

else
local result = MySQL.scalar.await('SELECT metadata FROM players WHERE citizenid = @identifier', {['@identifier'] = identifier})
result = json.decode(result)
for k, v in pairs(result.licences) do

result.licences = result.licences or {
['driver'] = true,
['business'] = false,
['weapon'] = false,
['pilot'] = false
}

for k, _ in pairs(incomingLicenses) do
result.licences[k] = incomingLicenses[k]
end
MySQL.query.await('UPDATE `players` SET `metadata` = @metadata WHERE citizenid = @citizenid', {['@metadata'] = json.encode(result), ['@citizenid'] = identifier})
Expand Down
10 changes: 8 additions & 2 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ RegisterNetEvent("ps-mdt:server:OnPlayerUnload", function()
end
end)

RegisterServerEvent("playerDropped")
AddEventHandler("playerDropped", function(reason)
--// Delete player from the MDT on logout
local src = source
Expand Down Expand Up @@ -218,6 +217,13 @@ QBCore.Functions.CreateCallback('mdt:server:GetProfileData', function(source, cb
if type(target.charinfo) == 'string' then target.charinfo = json.decode(target.charinfo) end
if type(target.metadata) == 'string' then target.metadata = json.decode(target.metadata) end

local licencesdata = target.metadata['licences'] or {
['driver'] = false,
['business'] = false,
['weapon'] = false,
['pilot'] = false
}

local job, grade = UnpackJob(target.job)

local person = {
Expand All @@ -227,7 +233,7 @@ QBCore.Functions.CreateCallback('mdt:server:GetProfileData', function(source, cb
job = job.label,
grade = grade.name,
pp = ProfPic(target.charinfo.gender),
licences = target.metadata['licences'],
licences = licencesdata,
dob = target.charinfo.birthdate,
mdtinfo = '',
fingerprint = '',
Expand Down
Loading

0 comments on commit a311296

Please sign in to comment.