GetNPCHealth

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
GetNPCHealth

Type: Function
Context: Server
Introduced: v1.0

Description

Returns NPC's health by its identifier.

Syntax

GetNPCHealth(npc)

Parameters

  • npc
    NPC you want to get health of

Return Value

  • The NPC health as a floating point number.

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