Ga naar hoofdinhoud

NPC_GetAnimation

waarschuwing

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

Description​

Gets the current animation data of an NPC.

NameDescription
npcidThe ID of the NPC
&animationIdVariable to store the animation ID
&deltaVariable to store the animation speed
&loopVariable to store whether animation loops
&lockXVariable to store X-axis lock state
&lockYVariable to store Y-axis lock state
&freezeVariable to store freeze state at end
&timeVariable to store animation time

Returns​

Returns true if the operation was successful, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/getanim", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You have no NPC.");

new animid, time;
new Float:delta;
new bool:loop, bool:lockX, bool:lockY, bool:freeze;

if (!NPC_GetAnimation(npcid, animid, delta, loop, lockX, lockY, freeze, time))
return SendClientMessage(playerid, 0xFF0000FF, "Failed to get animation data (maybe no active animation).");

SendClientMessage(playerid, 0xFFFFFFFF, "NPC %d animID: %d | delta: %.2f | loop: %d | lockX: %d | lockY: %d | freeze: %d | time: %d",
npcid, animid, delta, _:loop, _:lockX, _:lockY, _:freeze, time);

return 1;
}
return 0;
}

Notes​

  • This won't return data if used with NPC_SetAnimation
  • All parameters except npcid are passed by reference and will be modified
  • If the NPC has no active animation, animationId will be 0