پرش به مطلب اصلی

OnNPCRespawn

هشدار

This function was added in omp v1.5.8.3079 and will not work in earlier versions!

Description

This callback is called when an NPC respawns.

NameDescription
npcidThe ID of the NPC that respawned

Examples

public OnNPCRespawn(npcid)
{
printf("[NPC] NPC %d has respawned", npcid);

// Notify players tracking this NPC
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if (!IsPlayerConnected(playerid))
continue;

if (PlayerNPC[playerid] == npcid)
{
SendClientMessage(playerid, 0x00FF00FF, "Your tracked NPC %d has respawned", npcid);
}
}
return 1;
}

Notes

  • This callback is called after the NPC has been respawned using NPC_Respawn
  • The NPC's health and armor are automatically restored during respawn
  • Any ongoing movement, playback, etc, are stopped when respawning

The following functions might be useful, as they're related to this callback in one way or another.