---
title: "NPC_LoadRecord | open.mp"
description: "Loads an NPC recording file for playback."
canonical: https://omp.itsneufox.com/docs/scripting/functions/NPC_LoadRecord
language: en
---

# 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.

| 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

```c
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](https://omp.itsneufox.com/docs/scripting/functions/NPC_StartPlayback), `filePath` requires the full path from the server root, and the `.rec` extension.  
Example: `npcmodes/recordings/myrecording.rec`

## Related Functions

-   [NPC\_UnloadRecord](https://omp.itsneufox.com/docs/scripting/functions/NPC_UnloadRecord): Unload a recording
-   [NPC\_UnloadAllRecords](https://omp.itsneufox.com/docs/scripting/functions/NPC_UnloadAllRecords): Unload all recordings
-   [NPC\_StartPlayback](https://omp.itsneufox.com/docs/scripting/functions/NPC_StartPlayback): Start playing recording
-   [NPC\_GetRecordCount](https://omp.itsneufox.com/docs/scripting/functions/NPC_GetRecordCount): Get loaded record count

## Related Callbacks

-   [OnNPCPlaybackStart](https://omp.itsneufox.com/docs/scripting/callbacks/OnNPCPlaybackStart): Called when playback starts
-   [OnNPCPlaybackEnd](https://omp.itsneufox.com/docs/scripting/callbacks/OnNPCPlaybackEnd): Called when playback ends
