Pular para o conteúdo principal

NPC_IsMovingToPlayer

aviso

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

Descrição

Verifica se um NPC está se movendo em direção a um jogador específico.

NomeDescrição
npcidO ID do NPC
playeridO ID do jogador a ser verificado

Retornos

Retorna true se NPC estiver se movendo em direção ao jogador especificado, caso contrário, false.

Exemplos

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkmovingtowardme", 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 bool:isMovingToPlayer = NPC_IsMovingToPlayer(npcid, playerid);

SendClientMessage(playerid, 0x00FF00FF, "NPC %d is moving toward you: %s", npcid, isMovingToPlayer ? "Yes" : "No");
return 1;
}
return 0;
}

Notas

  • Esta função verifica se o NPC foi comandado para se mover em direção a um jogador específico usando NPC_MoveToPlayer
  • Retorna false se NPC não estiver se movendo ou estiver se movendo em direção a um alvo diferente

Funções Relacionadas

Callbacks Relacionadas