mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0d04ae282 | ||
|
|
c005c1b28b | ||
|
|
590044b5d6 | ||
|
|
3146172c0c |
@@ -29,15 +29,14 @@ AddEventHandler("gameEventTriggered", function(name, args)
|
|||||||
local victim = args[1]
|
local victim = args[1]
|
||||||
if not IsPedAPlayer(victim) or NetworkGetPlayerIndexFromPed(victim) ~= cache.playerId then return end
|
if not IsPedAPlayer(victim) or NetworkGetPlayerIndexFromPed(victim) ~= cache.playerId then return end
|
||||||
|
|
||||||
if not IsPedDeadOrDying(victim, true) then
|
|
||||||
local hit, bone = GetPedLastDamageBone(victim)
|
local hit, bone = GetPedLastDamageBone(victim)
|
||||||
if hit and usingAmbulance then
|
if hit and usingAmbulance then
|
||||||
local damageWeapon = ambulance:getLastDamagingWeapon(victim)
|
local damageWeapon = ambulance:getLastDamagingWeapon(victim)
|
||||||
return damageWeapon and ambulance:updateBodyDamage(bone, damageWeapon)
|
ambulance:updateBodyDamage(bone, damageWeapon)
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not IsPedDeadOrDying(victim, true) or GetEntityHealth(victim) > 100 then return end
|
||||||
|
|
||||||
local killerEntity, deathCause = GetPedSourceOfDeath(cache.ped), GetPedCauseOfDeath(cache.ped)
|
local killerEntity, deathCause = GetPedSourceOfDeath(cache.ped), GetPedCauseOfDeath(cache.ped)
|
||||||
local killerClientId = NetworkGetPlayerIndexFromPed(killerEntity)
|
local killerClientId = NetworkGetPlayerIndexFromPed(killerEntity)
|
||||||
if killerEntity ~= cache.ped and killerClientId and NetworkIsPlayerActive(killerClientId) then
|
if killerEntity ~= cache.ped and killerClientId and NetworkIsPlayerActive(killerClientId) then
|
||||||
|
|||||||
@@ -22,5 +22,31 @@ RegisterNetEvent("ND:updateLastLocation", function(location)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent("ND:revivePlayer", function()
|
RegisterNetEvent("ND:revivePlayer", function()
|
||||||
NDCore.revivePlayer(true)
|
if source == "" then return 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
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent("ND:characterUnloaded")
|
||||||
|
|||||||
@@ -33,50 +33,6 @@ function NDCore.getConfig(info)
|
|||||||
return Config[info]
|
return Config[info]
|
||||||
end
|
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(...)
|
function NDCore.notify(...)
|
||||||
lib.notify(...)
|
lib.notify(...)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user