mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-16 21:46:03 +01:00
refactor(client): revive function
This commit is contained in:
@@ -33,50 +33,6 @@ function NDCore.getConfig(info)
|
||||
return Config[info]
|
||||
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)
|
||||
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, GetEntityHeading(cache.ped), true, true, false)
|
||||
|
||||
local ped = PlayerPedId()
|
||||
if cache.ped ~= ped then
|
||||
DeleteEntity(cache.ped)
|
||||
ClearAreaOfPeds(coords.x, coords.y, coords.z, 0.2, false)
|
||||
end
|
||||
|
||||
SetEntityInvincible(ped, false)
|
||||
FreezeEntityPosition(ped, false)
|
||||
SetEntityVisible(ped, true)
|
||||
SetEveryoneIgnorePlayer(ped, false)
|
||||
SetPedCanBeTargetted(ped, true)
|
||||
SetEntityCanBeDamaged(ped, true)
|
||||
SetBlockingOfNonTemporaryEvents(ped, false)
|
||||
SetPedCanRagdollFromPlayerImpact(ped, true)
|
||||
ClearPedTasksImmediately(ped)
|
||||
|
||||
if veh and veh ~= 0 then
|
||||
SetPedIntoVehicle(ped, veh, seat)
|
||||
end
|
||||
if reset and GetPedMovementClipset(ped) == `move_m@injured` then
|
||||
ClearEntityLastDamageEntity(ped)
|
||||
SetPedMoveRateOverride(ped, 1.0)
|
||||
ResetPedMovementClipset(ped, 0)
|
||||
end
|
||||
if reset and usingAmbulance then
|
||||
exports["ND_Ambulance"]:resetBodyDamage()
|
||||
end
|
||||
end
|
||||
|
||||
function NDCore.notify(...)
|
||||
lib.notify(...)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user