function RemoveItemsAfterRPDeath()
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
Citizen.CreateThread(function()
ESX.TriggerServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function()
local formattedCoords = {
x = Config.RespawnPoint.coords.x,
y = Config.RespawnPoint.coords.y,
z = Config.RespawnPoint.coords.z
}
ESX.SetPlayerData('lastPosition', formattedCoords)
ESX.SetPlayerData('loadout', {})
TriggerServerEvent('esx:updateLastPosition', formattedCoords)
RespawnPed(PlayerPedId(), formattedCoords, Config.RespawnPoint.heading)
end)
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Citizen.Wait(10)
end
StopScreenEffect('DeathFailOut')
DoScreenFadeIn(800)
end)
end