diff --git a/client/interactions.lua b/client/interactions.lua index bb41344..c66f342 100644 --- a/client/interactions.lua +++ b/client/interactions.lua @@ -146,6 +146,22 @@ local function isTooFar(player, distance, maxDistance) return false end +RegisterNetEvent('police:client:checkBank', function() + local coords = GetEntityCoords(cache.ped) + local player, _, distance = lib.getClosestPlayer(coords) + if isTooFar(player, distance) then return end + local playerId = GetPlayerServerId(player) + TriggerServerEvent('police:server:checkBank', playerId) +end) + +RegisterNetEvent('police:client:checkLicenses', function() + local coords = GetEntityCoords(cache.ped) + local player, _, distance = lib.getClosestPlayer(coords) + if isTooFar(player, distance) then return end + local playerId = GetPlayerServerId(player) + TriggerServerEvent('police:server:checkLicenses', playerId) +end) + RegisterNetEvent('police:client:SearchPlayer', function() local coords = GetEntityCoords(cache.ped) local player, _, distance = lib.getClosestPlayer(coords) diff --git a/server/main.lua b/server/main.lua index fe92d4c..5d38a3e 100644 --- a/server/main.lua +++ b/server/main.lua @@ -321,6 +321,41 @@ RegisterNetEvent('police:server:FlaggedPlateTriggered', function(radar, plate, s end end) +RegisterNetEvent('police:server:checkBank', function(playerId) + local src = source + if isTargetTooFar(src, playerId, 2.5) then return end + + local player = exports.qbx_core:GetPlayer(src) + local searchedPlayer = exports.qbx_core:GetPlayer(playerId) + if not player or not searchedPlayer then return end + + if searchedPlayer then + TriggerClientEvent('chat:addMessage', source, { + template = '
Player has $'..searchedPlayer.PlayerData.money.bank..' in his bank account.
', + }) + end +end) + +RegisterNetEvent('police:server:checkLicenses', function(playerId) + local src = source + if isTargetTooFar(src, playerId, 2.5) then return end + + local searchedPlayer = exports.qbx_core:GetPlayer(playerId) + if searchedPlayer then + local licences = searchedPlayer.PlayerData.metadata.licences + local str = "" + + for k,v in pairs(licences) do + if k and v then + str = str .. k:gsub("^%l", string.upper) .. ', ' + end + end + TriggerClientEvent('chat:addMessage', source, { + template = '
Player Licenses: ' .. (#str == 0 and "No Licenses" or str:sub(1,#str-2)) .. '
', + }) + end +end) + RegisterNetEvent('police:server:SearchPlayer', function(playerId) local src = source if isTargetTooFar(src, playerId, 2.5) then return end