Lumaktaw patungo sa pangunahing content

NPC_LoadRecord

warning

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

Description​

Loads an NPC recording file for playback use.

NameDescription
const filePathThe path to the recording file

Returns​

Returns the ID of the loaded recording, or INVALID_RECORD_ID on failure.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/npcloadrecord ", true, 15))
{
new filepath[128];
new len = strlen(cmdtext);
if (len <= 15)
return SendClientMessage(playerid, 0xFF0000FF, "Usage: /npcloadrecord [filepath]");

strmid(filepath, cmdtext, 15, len);

new recordid = NPC_LoadRecord(filepath);

if (recordid == -1)
SendClientMessage(playerid, 0xFF0000FF, "Failed to load record from: %s", filepath);
else
SendClientMessage(playerid, 0x00FF00FF, "Record loaded from %s with ID: %d", filepath, recordid);
return 1;
}
return 0;
}

Notes​

  • Load recordings before using them with NPC_StartPlayback
warning

Unlike NPC_StartPlayback, filePath requires the full path from the server root, and the .rec extension.
Example: npcmodes/recordings/myrecording.rec