From a5665fdd1a53c726d7c2ebe52d95a4cac977ce02 Mon Sep 17 00:00:00 2001 From: citRa Date: Tue, 12 Dec 2023 23:09:09 -0400 Subject: [PATCH 1/3] fix: swap remaining job name checks to job type --- client/main.lua | 4 ++-- server/main.lua | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/main.lua b/client/main.lua index 541f1b41..c3056a79 100644 --- a/client/main.lua +++ b/client/main.lua @@ -77,7 +77,7 @@ AddEventHandler('QBCore:Client:OnPlayerLoaded', function() TriggerEvent('qb-clothing:client:loadOutfit', trackerClothingData) end - if PlayerJob and PlayerJob.name ~= 'police' then + if PlayerJob and PlayerJob.type ~= 'leo' then if DutyBlips then for _, v in pairs(DutyBlips) do RemoveBlip(v) @@ -109,7 +109,7 @@ RegisterNetEvent('QBCore:Client:SetDuty', function(newDuty) end) RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) - if JobInfo.name ~= 'police' then + if JobInfo.type ~= 'leo' then if DutyBlips then for _, v in pairs(DutyBlips) do RemoveBlip(v) diff --git a/server/main.lua b/server/main.lua index 59fe4ed3..f9b0f703 100644 --- a/server/main.lua +++ b/server/main.lua @@ -472,7 +472,7 @@ QBCore.Commands.Add('takedna', Lang:t('commands.takedna'), { { name = 'id', help local src = source local Player = QBCore.Functions.GetPlayer(src) local OtherPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) - if not OtherPlayer or Player.PlayerData.job.name ~= 'police' or not Player.PlayerData.job.onduty then return end + if not OtherPlayer or Player.PlayerData.job.type ~= 'leo' or not Player.PlayerData.job.onduty then return end if Player.Functions.RemoveItem('empty_evidence_bag', 1) then local info = { label = Lang:t('info.dna_sample'), @@ -673,7 +673,7 @@ RegisterNetEvent('police:server:CuffPlayer', function(playerId, isSoftcuff) local Player = QBCore.Functions.GetPlayer(src) local CuffedPlayer = QBCore.Functions.GetPlayer(playerId) - if not Player or not CuffedPlayer or (not Player.Functions.GetItemByName('handcuffs') and Player.PlayerData.job.name ~= 'police') then return end + if not Player or not CuffedPlayer or (not Player.Functions.GetItemByName('handcuffs') and Player.PlayerData.job.type ~= 'leo') then return end TriggerClientEvent('police:client:GetCuffed', CuffedPlayer.PlayerData.source, Player.PlayerData.source, isSoftcuff) end) @@ -763,7 +763,7 @@ RegisterNetEvent('police:server:BillPlayer', function(playerId, price) local Player = QBCore.Functions.GetPlayer(src) local OtherPlayer = QBCore.Functions.GetPlayer(playerId) - if not Player or not OtherPlayer or Player.PlayerData.job.name ~= 'police' then return end + if not Player or not OtherPlayer or Player.PlayerData.job.type ~= 'leo' then return end OtherPlayer.Functions.RemoveMoney('bank', price, 'paid-bills') exports['qb-banking']:AddMoney('police', price, 'Fine paid') @@ -780,7 +780,7 @@ RegisterNetEvent('police:server:JailPlayer', function(playerId, time) local Player = QBCore.Functions.GetPlayer(src) local OtherPlayer = QBCore.Functions.GetPlayer(playerId) - if not Player or not OtherPlayer or Player.PlayerData.job.name ~= 'police' then return end + if not Player or not OtherPlayer or Player.PlayerData.job.type ~= 'leo' then return end local currentDate = os.date('*t') if currentDate.day == 31 then From 65414e4d2f205f29ebd16578e2ae0aa767072072 Mon Sep 17 00:00:00 2001 From: citRa Date: Tue, 12 Dec 2023 23:10:44 -0400 Subject: [PATCH 2/3] fix: formatting --- client/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index c3056a79..f24724ae 100644 --- a/client/main.lua +++ b/client/main.lua @@ -139,7 +139,7 @@ end) RegisterNetEvent('police:client:UpdateBlips', function(players) if PlayerJob and (PlayerJob.type == 'leo' or PlayerJob.type == 'ems') and - PlayerJob.onduty then + PlayerJob.onduty then if DutyBlips then for _, v in pairs(DutyBlips) do RemoveBlip(v) From 9dd07bf4cf11179e1cb06e2c75eef00aae235917 Mon Sep 17 00:00:00 2001 From: citRa Date: Tue, 12 Dec 2023 23:29:58 -0400 Subject: [PATCH 3/3] fix: lint errors --- client/job.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/job.lua b/client/job.lua index e19fe2b1..89fd2674 100644 --- a/client/job.lua +++ b/client/job.lua @@ -401,7 +401,6 @@ RegisterNetEvent('police:client:EvidenceStashDrawer', function() currentEvidence = k end end - local pos = GetEntityCoords(PlayerPedId()) local takeLoc = Config.Locations['evidence'][currentEvidence] if not takeLoc then return end @@ -461,7 +460,7 @@ RegisterNetEvent('qb-police:client:openArmoury', function() price = item.price, amount = item.amount, info = item.info or {}, - type = itemType, + type = itemInfo.type, slot = #authorizedItemsList + 1 } end