From 7cc3bbe42aec751120aeb474d440be8bbe18aaf1 Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Sun, 19 Nov 2023 00:09:45 +0100 Subject: [PATCH] refactor: revive function --- client/functions.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index 074e0a5..be8d39f 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -28,6 +28,14 @@ end function NDCore.revivePlayer(reset, keepDead) local usingAmbulance = GetResourceState("ND_Ambulance") == "started" + if not keepDead then + LocalPlayer.state.dead = false + if usingAmbulance then + local state = Player(cache.serverId).state + state:set("isDead", false, true) + end + end + local veh = GetVehiclePedIsIn(cache.ped) local seat = cache.seat local coords = GetEntityCoords(cache.ped) @@ -36,7 +44,7 @@ function NDCore.revivePlayer(reset, keepDead) local ped = PlayerPedId() if cache.ped ~= ped then DeleteEntity(cache.ped) - ClearAreaOfPeds(coords.x, coords.y, coords.z, 1.5, false) + ClearAreaOfPeds(coords.x, coords.y, coords.z, 0.2, false) end SetEntityInvincible(ped, false) @@ -52,9 +60,6 @@ function NDCore.revivePlayer(reset, keepDead) if veh and veh ~= 0 then SetPedIntoVehicle(ped, veh, seat) end - if not keepDead then - LocalPlayer.state.dead = false - end if reset and GetPedMovementClipset(ped) == `move_m@injured` then ClearEntityLastDamageEntity(ped) SetPedMoveRateOverride(ped, 1.0)