From d0d04ae282e3c81f1aa299fd51524b379043dc8c Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:57:42 +0100 Subject: [PATCH] tweak(death): damage event for ambulance --- client/death.lua | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/client/death.lua b/client/death.lua index a673c87..f3d40f4 100644 --- a/client/death.lua +++ b/client/death.lua @@ -29,18 +29,13 @@ AddEventHandler("gameEventTriggered", function(name, args) local victim = args[1] if not IsPedAPlayer(victim) or NetworkGetPlayerIndexFromPed(victim) ~= cache.playerId then return end - if not IsPedDeadOrDying(victim, true) then - Wait(100) - local hit, bone = GetPedLastDamageBone(victim) - local alive = GetEntityHealth(victim) >= 100 - - if hit and usingAmbulance and alive then - local damageWeapon = ambulance:getLastDamagingWeapon(victim) - return damageWeapon and ambulance:updateBodyDamage(bone, damageWeapon) - end - - return not alive and PlayerEliminated(GetPedCauseOfDeath(cache.ped)) + local hit, bone = GetPedLastDamageBone(victim) + if hit and usingAmbulance then + local damageWeapon = ambulance:getLastDamagingWeapon(victim) + ambulance:updateBodyDamage(bone, damageWeapon) end + + if not IsPedDeadOrDying(victim, true) or GetEntityHealth(victim) > 100 then return end local killerEntity, deathCause = GetPedSourceOfDeath(cache.ped), GetPedCauseOfDeath(cache.ped) local killerClientId = NetworkGetPlayerIndexFromPed(killerEntity)