跳到主要內容

NPC_ClearAnimations

注意

此函式於 omp v1.5.8.3079 版本中新增,在更早的版本中無法使用!

Description​

Clears all animations from an NPC, returning it to its default state.

NameDescription
npcidThe ID of the NPC

Returns​

Returns true if the operation was successful, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/applydance", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

NPC_ApplyAnimation(npcid, "DANCING", "dance_loop", 4.1, true, false, false, false, 0);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been applied animation.", npcid);

SetTimerEx("ClearNPCAnimations", 25000, false, "ii", playerid, npcid);

return 1;
}
return 0;
}

forward ClearNPCAnimations(playerid, npcid);
public ClearNPCAnimations(playerid, npcid)
{

NPC_ClearAnimations(npcid);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d animations were cleared.", npcid);
}

Notes​

  • This function stops all currently playing animations including looping ones
  • The NPC will return to its default idle stance