Hello dear community! I hope you are all doing very well,
I’m currently having fun, or having a hard time creating a complete Medical System.
So far everything was fine, until I started doing my algorithm for Checking Players Injuries.
To put it simply, I have a function that checks the “Bones” of the players and depending on the type of weapon that caused the damage, it adds a Category of Injury and the importance of it.
To recover the “Bones” of injured players, I use the Native GetPedLastDamageBone() and everything works but I only need this information once, so to do this I use the Native ClearPedLastDamageBone() just after my check and there is the drama…
On the next check it returns the same GetPedLastDamageBone() to me as I asked ClearPedLastDamageBone() before.
Did I misunderstand Native? Am I doing it wrong?
Below you will find part of the code that is located on the problem encountered.
-- loop.lua:
while true do
-- Set Player Damage Data
setPedDamage(PlayerMedicalData)
Wait(10000)
end
-- setPedDamage.lua:
function setPedDamage(data)
local ped = PlayerPedId()
local status, bone = GetPedLastDamageBone(ped)
local PedBodyPart = string.format("%s", bone)
ClearEntityLastWeaponDamage(ped)
ClearPedLastWeaponDamage(ped)
ClearPedLastDamageBone(ped)
if PedBodyPart ~= 0 then
-- Code that defines the damage and on which part
end
end
I hope someone can enlighten me on this Native.