NPC_LoadRecord
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
Loads an NPC recording file for playback use.
| Name | Description |
|---|---|
| const filePath | The 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
cảnh báo
Unlike NPC_StartPlayback, filePath requires the full path from the server root, and the .rec extension.
Example: npcmodes/recordings/myrecording.rec
Related Functions
- NPC_UnloadRecord: Unload a recording
- NPC_UnloadAllRecords: Unload all recordings
- NPC_StartPlayback: Start playing recording
- NPC_GetRecordCount: Get loaded record count
Related Callbacks
- OnNPCPlaybackStart: Called when playback starts
- OnNPCPlaybackEnd: Called when playback ends