OnNPCCreate
warnung
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 is successfully created and added to the server.
| Name | Description |
|---|---|
| npcid | The ID of the NPC that was created |
Examples
public OnNPCCreate(npcid)
{
printf("[NPC] NPC %d has been created", npcid);
// Notify all connected players
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if (!IsPlayerConnected(playerid))
continue;
SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been created", npcid);
}
return 1;
}
Notes
- This callback is called immediately after the NPC is created but before it's spawned
- The NPC will need to be spawned using
NPC_Spawnto become visible in the game world
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- NPC_Create: Create a new NPC
- NPC_Destroy: Destroy an existing NPC
- NPC_Spawn: Spawn the NPC in the game world
Related Callbacks
- OnNPCDestroy: Called when an NPC is destroyed
- OnNPCSpawn: Called when an NPC is spawned