This section covers the most common problems that may occur during setup or integration of the resource, along with explanations and recommended solutions.
Revive Logic When the Player Is Not Technically Dead
In some systems, the player is considered downed or unconscious, while the ped is not technically dead.
This is commonly achieved by applying a custom downed or incapacitated animation instead of killing the player.
Using this approach is better for ped coordinate synchronization, because the player is never resurrected or respawned by the game engine.
The ped remains in the same network state, which prevents position desyncs, teleport issues, and camera glitches.
Core Idea
The ped may still be alive
The death screen can be active
Revive eligibility is determined by:
active downed animation
crawling animation
OR real death state
This allows medics to revive players who are incapacitated but not dead.
Detecting a Downed Player
You should explicitly check if the target player is playing one of your downed animations.
Example Conditions
Revive Eligibility Check
A player can be revived if any of the following is true:
local closestPlayerPed = GetPlayerPed(closestPlayer)
local isInDownedAnim = IsEntityPlayingAnim(
closestPlayerPed,
"missarmenian2",
"drunk_loop",
3
)
local isInCrawlingAnim = IsEntityPlayingAnim(
closestPlayerPed,
"missheist_agency3aig_19",
"ground_call_help",
3
)
local isDead = IsPedDeadOrDying(closestPlayerPed, true)
if isInDownedAnim or isInCrawlingAnim or isDead then
-- allow revive
end
function revivePlayer(closestPlayer)
isBusy = true
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
if quantity > 0 then
local closestPlayerPed = GetPlayerPed(closestPlayer)
local isInDeadAnim = IsEntityPlayingAnim(closestPlayerPed, "missarmenian2", "drunk_loop", 3) -- here code to check if player is in downed animation
local isInCrawlingAnim = IsEntityPlayingAnim(closestPlayerPed, "missheist_agency3aig_19", "ground_call_help", 3) -- here code to check crawling anim
if isInDeadAnim or isInCrawlingAnim or IsPedDeadOrDying(closestPlayerPed, 1) then -- here the instruction to check
local playerPed = PlayerPedId()
local lib, anim = 'mini@cpr@char_a@cpr_str', 'cpr_pumpchest'
ESX.ShowNotification(TranslateCap('revive_inprogress'))
for i = 1, 15 do
Wait(900)
ESX.Streaming.RequestAnimDict(lib, function()
TaskPlayAnim(playerPed, lib, anim, 8.0, -8.0, -1, 0, 0.0, false, false, false)
RemoveAnimDict(lib)
end)
end
TriggerServerEvent('esx_ambulancejob:removeItem', 'medikit')
TriggerServerEvent('esx_ambulancejob:revive', GetPlayerServerId(closestPlayer))
else
ESX.ShowNotification(TranslateCap('player_not_unconscious'))
end
else
ESX.ShowNotification(TranslateCap('not_enough_medikit'))
end
isBusy = false
end, 'medikit')
end