Skip to main content

OnNPCPlaybackStart

warning

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 starts playback of a recorded file.

NameDescription
npcidThe ID of the NPC that started playback
recordidThe ID of the record that started playing

Examples

public OnNPCPlaybackStart(npcid, recordid)
{
printf("[NPC] NPC %d started playback (record: %d)", npcid, recordid);

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

if (PlayerNPC[playerid] == npcid)
{
SendClientMessage(playerid, 0x00FF00FF, "NPC %d started playback (record ID: %d)", npcid, recordid);
}
}
return 1;
}

Notes

  • This callback is called immediately when NPC_StartPlayback is successfully executed
  • The recordid corresponds to the loaded record file
  • The NPC will follow the recorded movements from the file

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