function RemoveItemsAfterRPDeath()
--Nombreinter = Nombreinter - 1
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
Citizen.CreateThread(function()
DoScreenFadeOut(800)
while not IsScreenFadedOut() do
Citizen.Wait(10)
end
local radius = 100
local formattedCoords = {
x = ESX.Math.Round((coords.x + math.random(-radius, radius)), 1),
y = ESX.Math.Round((coords.y + math.random(-radius, radius)), 1),
z = ESX.Math.Round(coords.z + 1000, 1)
}
ESX.SetPlayerData('lastPosition', formattedCoords)
TriggerServerEvent('esx:updateLastPosition', formattedCoords)
RespawnPed(playerPed, formattedCoords, 0.0)
StopScreenEffect('DeathFailOut')
DoScreenFadeIn(800)
Citizen.Wait(10)
ClearPedTasksImmediately(playerPed)
local newcoords = GetEntityCoords(playerPed)
local newcoords = {
x = ESX.Math.Round(newcoords.x, 1),
y = ESX.Math.Round(newcoords.y, 1),
z = ESX.Math.Round(newcoords.z - GetEntityHeightAboveGround(playerPed), 1)
}
ESX.Game.Teleport(playerPed, newcoords, cb)
RequestAnimSet("move_injured_generic")
while not HasAnimSetLoaded("move_injured_generic") do
Citizen.Wait(0)
end
local ped = GetPlayerPed(PlayerId())
local coords = GetEntityCoords(ped, false)
local name = GetPlayerName(PlayerId())
local x, y, z = table.unpack(GetEntityCoords(ped, false))
TriggerServerEvent('esx_ambulance:NotificationBlipsX', x, y, z, name)
Citizen.Wait(5*1) -- Effets de la réanmation pendant 1 minute ( 60 seconde )
Normal()
end)
end