TaskPlayAnim() is not working for dead players. It would be really nice if someone could help me around with this, how to get it work for dead players.
sorry for such a small post i really have no content to extend this post.
There is no way to play animation on dead player, you need to set the health of a player to minimum 101 ( a value lesser than 100 means that the player is completly dead)
So you can make a loop and when the health is < 105 then play the animation and SetEntityInvincible
(so the player could not be killed and animation could not be stopped)
that means i have to create thread to check with ped health and once goes below or = 105 it will set invincible and put some rag doll anim for player right?? will that work??
Done Thanks for the help!!
What was the code you wrote to do the animation?
Citizen.CreateThread(function()
while true do
if IsDead and not (carryingBackInProgress or isinside or isOnBed) then
if GetVehiclePedIsIn(PlayerPedId(), false) ~=0 then
TaskLeaveVehicle(PlayerPedId(),GetVehiclePedIsIn(PlayerPedId(), false),0)
end
SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000,0, 0, 0, 0)
end
if IsDead and (IsPedWalking(PlayerPedId()) or IsPedSprinting(PlayerPedId()) or
IsPedRunning(PlayerPedId())) then
carryingBackInProgress = false
inside = false
isOnBed = false
end
Citizen.Wait(200)
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsDead then
DisableControlAction(0,24,true) -- disable attack
DisableControlAction(0,25,true) -- disable aim
DisableControlAction(0,47,true) -- disable weapon
DisableControlAction(0,58,true) -- disable weapon
DisableControlAction(0,263,true) -- disable melee
DisableControlAction(0,264,true) -- disable melee
DisableControlAction(0,257,true) -- disable melee
DisableControlAction(0,140,true) -- disable melee
DisableControlAction(0,141,true) -- disable melee
DisableControlAction(0,142,true) -- disable melee
DisableControlAction(0,143,true) -- disable melee
DisableControlAction(0,32,true) -- move (w)
DisableControlAction(0,34,true) -- move (a)
DisableControlAction(0,33,true) -- move (s)
DisableControlAction(0,35,true) -- move (d)
DisableControlAction(0,48,true) -- move (d)
EnableControlAction(0, Keys['G'], true)
EnableControlAction(0, Keys['T'], true)
EnableControlAction(0, Keys['E'], true)
DisableControlAction(0, Keys['F'], true)
DisableControlAction(0, Keys['F3'], true) -- NO MENUS
DisableControlAction(0, Keys['F6'], true) -- NO MENUS
DisableControlAction(0, Keys['F7'], true) -- NO MENUS
DisableControlAction(0, Keys['F9'], true) -- NO MENUS
end
end
end)
function loadAnimDict(dict)
while (not HasAnimDictLoaded(dict)) do
RequestAnimDict(dict)
Citizen.Wait(5)
end
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
health = GetEntityHealth(PlayerPedId())
if health <= 105 then
SetEntityInvincible(PlayerPedId(), true)
SetEntityHealth(PlayerPedId(), 105)
if not flag then
OnPlayerDeath()
flag = true
end
end
end
end)
function OnPlayerDeath()
IsDead = true
-- StopScreenEffect('DeathFailOut')
TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
StartDistressSignal()
StartDeathTimer()
end
These are the few codes that i have tried and remaining you need to configure
isEntityDead()
to
if GetEntityHealth(PlayerPedId())<=105 then
---do the stuff
end
hope this gives a brief idea to proceed on this & sorry for the late reply
Can you upload this script for download?
why don’t you send the whole script
you do not have the script all complete all the esx_ambulancejob with your lines