Skip to content

Commit

Permalink
[qb-mdt] - Remove firefighter
Browse files Browse the repository at this point in the history
Have opted to not include a generic function for checking jobtype is allowed. This is due to server side requiring a little bit more specific checks per function/callback.
  • Loading branch information
trapw0w authored May 8, 2022
1 parent a87df67 commit 48bb0e9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ RegisterNetEvent('mdt:server:getAllReports', function()
local Player = QBCore.Functions.GetPlayer(src)
if Player then
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'doj' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'doj' or JobType == 'ambulance' then
if JobType == 'doj' then JobType = 'police' end
local matches = MySQL.query.await("SELECT * FROM `mdt_reports` WHERE jobtype = :jobtype ORDER BY `id` DESC LIMIT 30", {
jobtype = JobType
Expand All @@ -567,7 +567,7 @@ RegisterNetEvent('mdt:server:getReportData', function(sentId)
local Player = QBCore.Functions.GetPlayer(src)
if Player then
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'doj' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'doj' or JobType == 'ambulance' then
if JobType == 'doj' then JobType = 'police' end
local matches = MySQL.query.await("SELECT * FROM `mdt_reports` WHERE `id` = :id AND `jobtype` = :jobtype LIMIT 1", {
id = sentId,
Expand All @@ -590,7 +590,7 @@ RegisterNetEvent('mdt:server:searchReports', function(sentSearch)
local Player = QBCore.Functions.GetPlayer(src)
if Player then
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'doj' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'doj' or JobType == 'ambulance' then
if JobType == 'doj' then JobType = 'police' end
local matches = MySQL.query.await("SELECT * FROM `mdt_reports` WHERE `id` LIKE :query OR LOWER(`author`) LIKE :query OR LOWER(`title`) LIKE :query OR LOWER(`type`) LIKE :query OR LOWER(`details`) LIKE :query OR LOWER(`tags`) LIKE :query AND `jobtype` = :jobtype ORDER BY `id` DESC LIMIT 50", {
query = string.lower('%'..sentSearch..'%'), -- % wildcard, needed to search for all alike results
Expand Down Expand Up @@ -1010,7 +1010,7 @@ RegisterNetEvent('mdt:server:setWaypoint', function(callid)
local src = source
local Player = QBCore.Functions.GetPlayer(source)
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
local calls = exports['qb-dispatch']:GetDispatchCalls()
TriggerClientEvent('mdt:client:setWaypoint', src, calls[callid])
Expand All @@ -1028,7 +1028,7 @@ RegisterNetEvent('mdt:server:callDetach', function(callid)
callsign = Player.PlayerData.metadata.callsign
}
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
TriggerEvent('dispatch:removeUnit', callid, playerdata, function(newNum)
TriggerClientEvent('mdt:client:callDetach', -1, callid, newNum)
Expand All @@ -1047,7 +1047,7 @@ RegisterNetEvent('mdt:server:callAttach', function(callid)
callsign = Player.PlayerData.metadata.callsign
}
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
TriggerEvent('dispatch:addUnit', callid, playerdata, function(newNum)
TriggerClientEvent('mdt:client:callAttach', -1, callid, newNum)
Expand All @@ -1061,7 +1061,7 @@ RegisterNetEvent('mdt:server:attachedUnits', function(callid)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
local calls = exports['qb-dispatch']:GetDispatchCalls()
TriggerClientEvent('mdt:client:attachedUnits', src, calls[callid]['units'], callid)
Expand All @@ -1080,7 +1080,7 @@ RegisterNetEvent('mdt:server:callDispatchDetach', function(callid, cid)
}
local callid = tonumber(callid)
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
TriggerEvent('dispatch:removeUnit', callid, playerdata, function(newNum)
TriggerClientEvent('mdt:client:callDetach', -1, callid, newNum)
Expand All @@ -1094,7 +1094,7 @@ RegisterNetEvent('mdt:server:setDispatchWaypoint', function(callid, cid)
local Player = QBCore.Functions.GetPlayer(src)
local callid = tonumber(callid)
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
local calls = exports['qb-dispatch']:GetDispatchCalls()
TriggerClientEvent('mdt:client:setWaypoint', src, calls[callid])
Expand All @@ -1114,7 +1114,7 @@ RegisterNetEvent('mdt:server:callDragAttach', function(callid, cid)
}
local callid = tonumber(callid)
local JobType = GetJobType(Player.PlayerData.job.name)
if JobType == 'police' or JobType == 'ambulance' or JobType == 'firefighter' then
if JobType == 'police' or JobType == 'ambulance' then
if callid then
TriggerEvent('dispatch:addUnit', callid, playerdata, function(newNum)
TriggerClientEvent('mdt:client:callAttach', -1, callid, newNum)
Expand Down

0 comments on commit 48bb0e9

Please sign in to comment.