mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Fixed remove blips on change job, fixed blip not properly registering
This commit is contained in:
+14
-3
@@ -4,9 +4,7 @@ local isBusy, deadPlayers, deadPlayerBlips, isOnDuty = false, {}, {}, false
|
||||
isInShopMenu = false
|
||||
|
||||
function OpenAmbulanceActionsMenu()
|
||||
local elements = {
|
||||
{label = _U('cloakroom'), value = 'cloakroom'}
|
||||
}
|
||||
local elements = {{label = _U('cloakroom'), value = 'cloakroom'}}
|
||||
|
||||
if Config.EnablePlayerManagement and ESX.PlayerData.job.grade_name == 'boss' then
|
||||
table.insert(elements, {label = _U('boss_actions'), value = 'boss_actions'})
|
||||
@@ -437,6 +435,7 @@ function OpenCloakroomMenu()
|
||||
end
|
||||
|
||||
isOnDuty = true
|
||||
TriggerEvent('esx_ambulancejob:setDeadPlayers', deadPlayers)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -480,6 +479,18 @@ AddEventHandler('esx_ambulancejob:heal', function(healType, quiet)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
if isOnDuty and job ~= 'ambulance' then
|
||||
for playerId,v in pairs(deadPlayerBlips) do
|
||||
RemoveBlip(v)
|
||||
deadPlayerBlips[playerId] = nil
|
||||
end
|
||||
|
||||
isOnDuty = false
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_ambulancejob:setDeadPlayers')
|
||||
AddEventHandler('esx_ambulancejob:setDeadPlayers', function(_deadPlayers)
|
||||
deadPlayers = _deadPlayers
|
||||
|
||||
+1
-2
@@ -30,6 +30,7 @@ end)
|
||||
|
||||
AddEventHandler('playerSpawned', function()
|
||||
isDead = false
|
||||
TriggerServerEvent('esx_ambulancejob:onPlayerSpawn')
|
||||
|
||||
if firstSpawn then
|
||||
exports.spawnmanager:setAutoSpawn(false) -- disable respawn
|
||||
@@ -45,8 +46,6 @@ AddEventHandler('playerSpawned', function()
|
||||
RemoveItemsAfterRPDeath()
|
||||
end
|
||||
end)
|
||||
else
|
||||
TriggerServerEvent('esx_ambulancejob:onPlayerSpawn')
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user