mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Some fixed to blip system closes #77
This commit is contained in:
+18
-8
@@ -157,6 +157,7 @@ function OpenCloakroomMenu()
|
||||
TriggerServerEvent('esx_service:notifyAllInService', notification, 'police')
|
||||
|
||||
TriggerServerEvent('esx_service:disableService', 'police')
|
||||
TriggerEvent('esx_policejob:updateBlip')
|
||||
ESX.ShowNotification(_U('service_out'))
|
||||
playerInService = false
|
||||
end
|
||||
@@ -185,6 +186,7 @@ function OpenCloakroomMenu()
|
||||
}
|
||||
|
||||
TriggerServerEvent('esx_service:notifyAllInService', notification, 'police')
|
||||
TriggerEvent('esx_policejob:updateBlip')
|
||||
ESX.ShowNotification(_U('service_in'))
|
||||
serviceOk = true
|
||||
playerInService = true
|
||||
@@ -1918,14 +1920,14 @@ end)
|
||||
|
||||
-- Create blip for colleagues
|
||||
function createBlip(id)
|
||||
ped = GetPlayerPed(id)
|
||||
blip = GetBlipFromEntity(ped)
|
||||
|
||||
local ped = GetPlayerPed(id)
|
||||
local blip = GetBlipFromEntity(ped)
|
||||
|
||||
if not DoesBlipExist(blip) then -- Add blip and create head display on player
|
||||
blip = AddBlipForEntity(ped)
|
||||
SetBlipSprite(blip, 1)
|
||||
ShowHeadingIndicatorOnBlip(blip, true) -- Player Blip indicator
|
||||
SetBlipRotation(blip, math.ceil(GetEntityHeading(veh))) -- update rotation
|
||||
SetBlipRotation(blip, math.ceil(GetEntityHeading(ped))) -- update rotation
|
||||
SetBlipNameToPlayerName(blip, id) -- update blip name
|
||||
SetBlipScale(blip, 0.85) -- set scale
|
||||
SetBlipAsShortRange(blip, true)
|
||||
@@ -1944,16 +1946,24 @@ AddEventHandler('esx_policejob:updateBlip', function()
|
||||
|
||||
-- Clean the blip table
|
||||
blipsCops = {}
|
||||
|
||||
-- Enable blip?
|
||||
if Config.MaxInService ~= -1 and not playerInService then
|
||||
return
|
||||
end
|
||||
|
||||
if not Config.EnableJobBlip the
|
||||
return
|
||||
end
|
||||
|
||||
-- Is the player a cop? In that case show all the blips for other cops
|
||||
if PlayerData.job ~= nil and 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
|
||||
for id = 0, 32 do
|
||||
if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= PlayerPedId() and GetPlayerName(id) == players[i].name then
|
||||
createBlip(id)
|
||||
end
|
||||
local id = GetPlayerFromServerId(players[i].source)
|
||||
if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= PlayerPedId() then
|
||||
createBlip(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,6 +15,8 @@ Config.EnableLicenses = false -- only turn this on if you are using
|
||||
Config.EnableHandcuffTimer = true -- enable handcuff timer? will unrestrain player after the time ends
|
||||
Config.HandcuffTimer = 10 * 60000 -- 10 mins
|
||||
|
||||
Config.EnableJobBlip = true -- enable blips for colleagues
|
||||
|
||||
Config.MaxInService = -1
|
||||
Config.Locale = 'fr'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user