I added the ability to revive people from the police menu.
Requires esx_ambulance job obviously
Add this to your police menu in the client main.lua
{label = _U('revive player'), value = 'revive'},
Remember if it is at the end of this list you need to remove the comma.
Then add this
if data2.current.value == 'revive' then
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
local closestPlayerPed = GetPlayerPed(closestPlayer)
local health = GetEntityHealth(closestPlayerPed)
if health == 0 then
local playerPed = GetPlayerPed(-1)
Citizen.CreateThread(function()
ESX.ShowNotification(_U('revive_inprogress'))
TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true)
Wait(10000)
ClearPedTasks(playerPed)
if GetEntityHealth(closestPlayerPed) == 0 then
TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer))
ESX.ShowNotification(_U('revive_complete'))
else
ESX.ShowNotification(_U('isdead'))
end
end)
end
end
ABOVE your police menus if thens…
if data2.current.value == 'identity_card' then
OpenIdentityCardMenu(player)
end
NEXT
Add this to your server main.lua
RegisterServerEvent('esx_ambulancejob:revive')
AddEventHandler('esx_ambulancejob:revive', function(target)
TriggerClientEvent('esx_ambulancejob:revive', target)
end)
LASTLY
Add these to your locales.lua
['revive player'] = 'revive player',
['revive_inprogress'] = 'revive in progress',
['revive_complete'] = 'revive complete',
['isdead'] = 'Player Dead',