SA-MP Forums Archive
ApplyAnimation - PROBLEM - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ApplyAnimation - PROBLEM (/showthread.php?tid=306766)



ApplyAnimation - PROBLEM - SuperChock - 27.12.2011

Hello, I have a problem with ApplyAnimation function. When I use:

pawn Code:
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 1.0, 0, 1, 1, 1, 0);
In my command, the function doesn't work in first execution, then if I execute the command again, the function work normaly.

Anyone know why?

Thanks and sorry from my bad english.


AW: ApplyAnimation - PROBLEM - Drebin - 27.12.2011

It's a SA-MP issue.
You have to apply nearly every animation twice before it works.


Re: ApplyAnimation - PROBLEM - SuperChock - 27.12.2011

Holy shit... '-'

Ok, thanks


Re: ApplyAnimation - PROBLEM - MP2 - 28.12.2011

It's a GTA issue. You have to pre-load the animtion library to apply animations from it. One solution is to, as Drebin stated, apply animations twice. You could make a custom function for this for ease:

pawn Code:
stock ApplyPlayerAnimation(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0)
{
    ApplyAnimation(playerid, animlib, "null", fDelta, loop, lockx, locky, freeze, time, forcesync); // Pre-load animation library
    return ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
}
Use ApplyPlayerAnimation instead of ApplyAnimation. [not tested.]