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.
| Nome | Descrição |
|---|---|
| npcid | O 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
- NPC_SetHealth: Definir integridade de NPC
- NPC_GetArmour: Obtenha a armadura NPC
- NPC_SetArmour: Definir armadura NPC
- NPC_IsDead: Verifique se NPC está morto
Callbacks Relacionadas
- OnNPCTakeDamage: Chamado quando NPC sofre dano
- OnNPCDeath: Chamado quando NPC morre