This is the updated version for the most current esx_police job as of 7/26/18
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 action == '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
elseif action == 'identity_card' then
OpenIdentityCardMenu(closestPlayer)
elseif action == 'body_search' then
TriggerServerEvent('esx_policejob:message', GetPlayerServerId(closestPlayer), _U('being_searched'))
elseif....
It should look like this after.
local action = data2.current.value
if action == '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
elseif action == 'identity_card' then
OpenIdentityCardMenu(closestPlayer)
elseif action == 'body_search' then
TriggerServerEvent('esx_policejob:message', GetPlayerServerId(closestPlayer), _U('being_searched'))
OpenBodySearchMenu(closestPlayer)
elseif action == 'handcuff' then
TriggerServerEvent('esx_policejob:handcuff', GetPlayerServerId(closestPlayer))
elseif action == 'drag' then
TriggerServerEvent('esx_policejob:drag', GetPlayerServerId(closestPlayer))
elseif action == 'put_in_vehicle' then
TriggerServerEvent('esx_policejob:putInVehicle', GetPlayerServerId(closestPlayer))
elseif action == 'out_the_vehicle' then
TriggerServerEvent('esx_policejob:OutVehicle', GetPlayerServerId(closestPlayer))
elseif action == 'fine' then
OpenFineMenu(closestPlayer)
elseif action == 'license' then
ShowPlayerLicense(closestPlayer)
elseif action == 'unpaid_bills' then
OpenUnpaidBillsMenu(closestPlayer)
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
['revive player'] = 'revive player',
['revive_inprogress'] = 'revive in progress',
['revive_complete'] = 'revive complete',
['isdead'] = 'Player Dead',