Pular para o conteúdo principal

NPC_GetHealth

aviso

Esta função foi adicionada no omp v1.5.8.3079 e não funcionará em versões anteriores!

Descrição

Obtém o valor de integridade de um NPC.

NomeDescrição
npcidO ID do NPC

Retornos

Retorna a integridade do NPC como um valor flutuante.

Exemplos

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkhealth", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

if (!NPC_IsValid(npcid))
return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

new Float:health = NPC_GetHealth(npcid);

SendClientMessage(playerid, 0x00FF00FF, "NPC %d health: %.2f", npcid, health);
return 1;
}
return 0;
}

Notas

  • Os valores de saúde normalmente variam de 0,0 a 100,0
  • Um NPC com 0,0 de saúde é considerado morto

Funções Relacionadas

Callbacks Relacionadas