From cdb9ce0c16902efc9c814eeb11f0f062b7db3f0f Mon Sep 17 00:00:00 2001 From: Christian J Bennett Date: Thu, 23 May 2024 18:08:06 -0500 Subject: [PATCH] Fixed PlayerStatus --- client/job.lua | 2 +- locales/en.lua | 5 +++-- server/main.lua | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/job.lua b/client/job.lua index 6a5de60..739fb44 100644 --- a/client/job.lua +++ b/client/job.lua @@ -354,7 +354,7 @@ RegisterNetEvent('police:client:CheckStatus', function() QBCore.Functions.TriggerCallback('police:GetPlayerStatus', function(result) if result then for _, v in pairs(result) do - QBCore.Functions.Notify('' .. v .. '') + QBCore.Functions.Notify('Player comes back with ' .. v) end end end, playerId) diff --git a/locales/en.lua b/locales/en.lua index 6f4d271..f2022db 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -26,7 +26,8 @@ local Translations = { no_driver_license = 'No drivers license', not_cuffed_dead = 'Civilian isn\'t cuffed or dead', fine_yourself = 'You Cannot Fine Yourself', - not_online = 'This person is not online' + not_online = 'This person is not online', + no_status = 'No status found for the person', }, success = { uncuffed = 'You have been uncuffed', @@ -117,7 +118,7 @@ local Translations = { officer_down = 'Officer %{lastname} | %{callsign} Down', fine_issued = 'Fine has been issued to offender succesfully', received_fine = 'State Debt Recovery has automatically recovered the fines owed...', - camera_speed= 'Speed camera #%{radarid} - Marked vehicle' + camera_speed = 'Speed camera #%{radarid} - Marked vehicle' }, evidence = { diff --git a/server/main.lua b/server/main.lua index 6531e2d..1fac949 100644 --- a/server/main.lua +++ b/server/main.lua @@ -542,7 +542,7 @@ QBCore.Functions.CreateCallback('police:server:isPlayerDead', function(_, cb, pl cb(Player.PlayerData.metadata['isdead']) end) -QBCore.Functions.CreateCallback('police:GetPlayerStatus', function(_, cb, playerId) +QBCore.Functions.CreateCallback('police:GetPlayerStatus', function(source, cb, playerId) local Player = QBCore.Functions.GetPlayer(playerId) local statList = {} if Player then @@ -550,6 +550,8 @@ QBCore.Functions.CreateCallback('police:GetPlayerStatus', function(_, cb, player for k in pairs(PlayerStatus[Player.PlayerData.source]) do statList[#statList + 1] = PlayerStatus[Player.PlayerData.source][k].text end + else + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.no_status'), 'error') end end cb(statList)