GetNPCHealth: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
AddCommand('npchealth', checkHealth) | AddCommand('npchealth', checkHealth) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
*[[SetNPCRagdoll]] | |||
*[[SetNPCDimension]] | |||
*[[GetNPCDimension]] | |||
*[[SetNPCPropertyValue]] | |||
*[[GetNPCPropertyValue]] | |||
*[[CreateNPC]] | |||
*[[DestroyNPC]] | |||
*[[IsValidNPC]] | |||
*[[GetAllNPC]] | |||
*[[GetNPCCount]] | |||
*[[IsNPCStreamedIn]] | |||
*[[SetNPCLocation]] | |||
*[[GetNPCLocation]] | |||
*[[SetNPCHealth]] | |||
*[[GetNPCHealth]] | |||
*[[SetNPCAnimation]] | |||
*[[SetNPCHeading]] | |||
*[[GetNPCHeading]] | |||
*[[SetNPCTargetLocation]] | |||
*[[SetNPCFollowPlayer]] | |||
*[[SetNPCFollowVehicle]] |
Revision as of 14:50, 23 December 2020
Description
Returns NPC's health by its ID
Syntax
GetNPCHealth(npc)
Parameters
- npc
NPC you want to get health of
Return Value
- NPC Health
Example
function checkHealth(player, npc)
if IsValidNPC(tonumber(npc) then
AddPlayerChat(player, 'NPC has: ' .. GetNPCHealth(tonumber(npc)) .. ' health')
else
AddPlayerChat(player, 'This NPC doesn\'t exist!')
end
end
AddCommand('npchealth', checkHealth)
See also
- SetNPCRagdoll
- SetNPCDimension
- GetNPCDimension
- SetNPCPropertyValue
- GetNPCPropertyValue
- CreateNPC
- DestroyNPC
- IsValidNPC
- GetAllNPC
- GetNPCCount
- IsNPCStreamedIn
- SetNPCLocation
- GetNPCLocation
- SetNPCHealth
- GetNPCHealth
- SetNPCAnimation
- SetNPCHeading
- GetNPCHeading
- SetNPCTargetLocation
- SetNPCFollowPlayer
- SetNPCFollowVehicle