OnNPCRespawn
cảnh báo
Đã thêm hàm trong phiên bản omp v1.5.8.3079. Mục này không hoạt động trên các phiên bản cũ hơn!
Description
This callback is called when an NPC respawns.
| Name | Description |
|---|---|
| npcid | The 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
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- NPC_Respawn: Respawn an NPC
- NPC_Spawn: Spawn an NPC for the first time
- NPC_SetHealth: Set NPC's health
- NPC_SetPos: Set NPC's position
Related Callbacks
- OnNPCSpawn: Called when an NPC spawns for the first time
- OnNPCDeath: Called when an NPC dies
- OnPlayerSpawn: Called when a player spawns