Check = function()
while true do
if FrontPedIsHitByPlayer() then
PedApplyDamage(PlayerHitPed, 10000000)
end
Wait (0)
end
end
HealthRecords = function()
while true do
if IsInTable(AllPedHealth, Ped) then
AllPedHealth[InTableIndex(AllPedHealth, Ped) + 1] = PedGetHealth(Ped)
else
table.insert(Ped)
table.insert(PedGetHealth(Ped))
end
Wait(0)
end
end
FrontPedIsHitByPlayer = function()
for NPC, Ped in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
if IsInTable(AllPedHealth, Ped) and PedGetHealth(Ped) ~= AllPedHealth[InTableIndex(AllPedHealth, Ped) + 1] and PedGetWhoHitMeLast(Ped) == gPlayer and Ped ~= gPlayer then
PlayerHitPed = Ped
return true
end
end
return false
end
I want to check ped is hit by player or not, but it doesn't work, I use PedIsHit(), but after the Ped is grabbed, PedIsHit is invalid