I’m looking for the way of checking the entity is invincible or not.
I saw the SetEntityInvincible description write this native.
But, It always return a nil value.
https://runtime.fivem.net/doc/natives/?_0x3882114BDE571AD4
0x3882114BDE571AD4 0xC1213A21
-- SET_ENTITY_INVINCIBLE
SetEntityInvincible(
entity --[[ Entity ]],
toggle --[[ boolean ]]
)
Use this if you want to get the invincibility status:
bool IsPedInvincible(Ped ped)
{
This is the code I used for print(IsPedInvincible)
Citizen.CreateThread(function()
RequestModel(GetHashKey("s_f_y_cop_01"))
while not HasModelLoaded(GetHashKey("s_f_y_cop_01")) do
Wait(1)
end
local npc = CreatePed(1, GetHashKey("s_f_y_cop_01"), -1038.58, -1396.94, 4.55, 73.55, false, false)
FreezeEntityPosition(npc, true)
SetEntityHeading(npc, 73.55)
SetEntityInvincible(npc, true)
SetBlockingOfNonTemporaryEvents(npc, true)
SetPedCanPlayAmbientAnims(npc, true)
print(IsPedInvincible(npc))
end)
The fx_version is:
fx_version 'adamant'