I am trying to show the blips only for “in-service” cops.
When a cop goes “in-service”, he can see all other cops no matter their service status. I want them to see only “in-service” cops. The problem is that if a cop is out of service, he can do whatever he wants, and if other cops can see him on the map, this automatically creates a meta-gaming situation.
Can someone help me edit this?
RegisterNetEvent('esx_policejob:updateBlip')
AddEventHandler('esx_policejob:updateBlip', function()
-- Refresh all blips
for k, existingBlip in pairs(blipsCops) do
RemoveBlip(existingBlip)
end
-- Clean the blip table
blipsCops = {}
-- Enable blip?
if Config.EnableESXService and not playerInService then
return
end
if not Config.EnableJobBlip then
return
end
-- Is the player a cop? In that case show all the blips for other cops
if ESX.PlayerData.job and ESX.PlayerData.job.name == 'police' then
ESX.TriggerServerCallback('esx_society:getOnlinePlayers', function(players)
for i=1, #players, 1 do
if players[i].job.name == 'police' then
local id = GetPlayerFromServerId(players[i].source)
if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= PlayerPedId() then
createBlip(id)
end
end
end
end)
end
end)