Lewati ke konten utama

NPC_StartPlaybackEx

peringatan

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

Description

Starts playback for an NPC using a pre-loaded recording ID with extended options.

NameDescription
npcidThe ID of the NPC
recordIdThe pre-loaded recording ID
autoUnloadWhether to automatically unload after playback
startXX offset from recording position
startYY offset from recording position
startZZ offset from recording position
rotXX rotation offset
rotYY rotation offset
rotZZ rotation offset

Returns

Returns true if the operation was successful, false otherwise.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/startplaybackex ", true, 17))
{
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 recordId = strval(cmdtext[17]);

new Float:x, Float:y, Float:z;
NPC_GetPos(npcid, x, y, z);

new bool:success = NPC_StartPlaybackEx(npcid, recordId, true, x, y, z, 0.0, 0.0, 0.0);

if (success)
SendClientMessage(playerid, 0x00FF00FF, "NPC %d started playback with record ID: %d", npcid, recordId);
else
SendClientMessage(playerid, 0xFF0000FF, "Failed to start playback for NPC %d with record ID %d", npcid, recordId);

return 1;
}
return 0;
}

Notes

  • Recording must be pre-loaded with NPC_LoadRecord
  • Auto-unload saves memory when playback completes