Saltar al contenido principal

OnNPCPlaybackEnd

aviso

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

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

Examples

public OnNPCPlaybackEnd(npcid, recordid)
{
printf("[NPC] NPC %d finished 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 finished playback (record ID: %d)", npcid, recordid);
}
}
return 1;
}

Notes

  • This callback is called when the recording reaches its end naturally
  • It's also called when playback is stopped manually using NPC_StopPlayback
  • The recordid corresponds to the loaded record file

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