From 119b0034bfc08c19fe8ad3f3a6bf2dd117979a61 Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Fri, 17 Jan 2025 21:12:43 +0100 Subject: [PATCH] feat(client): replace armor on revive When reviving player to heal, replace the armor with the previous amount. --- client/events.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/client/events.lua b/client/events.lua index 492c4cf..13eb73e 100644 --- a/client/events.lua +++ b/client/events.lua @@ -23,14 +23,17 @@ end) RegisterNetEvent("ND:revivePlayer", function() if source == "" then return end - local veh = GetVehiclePedIsIn(cache.ped) + local oldPed = cache.ped + local veh = GetVehiclePedIsIn(oldPed) local seat = cache.seat - local coords = GetEntityCoords(cache.ped) - NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, GetEntityHeading(cache.ped), true, true, false) + local coords = GetEntityCoords(oldPed) + local armor = GetPedArmour(oldPed) + + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, GetEntityHeading(oldPed), true, true, false) local ped = PlayerPedId() - if cache.ped ~= ped then - DeleteEntity(cache.ped) + if oldPed ~= ped then + DeleteEntity(oldPed) ClearAreaOfPeds(coords.x, coords.y, coords.z, 0.2, false) end @@ -43,6 +46,7 @@ RegisterNetEvent("ND:revivePlayer", function() SetBlockingOfNonTemporaryEvents(ped, false) SetPedCanRagdollFromPlayerImpact(ped, true) ClearPedTasksImmediately(ped) + SetPedArmour(ped, armor) if veh and veh ~= 0 then SetPedIntoVehicle(ped, veh, seat)