GetEntityHealth
Docslocal retval = GetEntityHealth(entity)Description
Returns an integer value of entity's current health.
Example of range for ped:
- Player [0 to 200]
- Ped [100 to 200]
- Vehicle [0 to 1000]
- Object [0 to 1000]
In order to get the actual value, do:
float health = (float )(entityAddress + 0x280);
Parameters
| Name | Type | Description |
|---|---|---|
entity | Entity | The entity to get the health from. |
Quick Snippet: Get Entityentity
entityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endReturns
intReturns an integer value.
Examples
Official
local health = GetEntityHealth(PlayerPedId())
print(health)