PDA

View Full Version : ApplyAnimation - PROBLEM


SuperChock
27/12/2011, 10:46 PM
Hello, I have a problem with ApplyAnimation function. When I use:


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.

Drebin
27/12/2011, 10:53 PM
It's a SA-MP issue.
You have to apply nearly every animation twice before it works.

SuperChock
27/12/2011, 11:02 PM
Holy shit... '-'

Ok, thanks :D

MP2
28/12/2011, 01:40 AM
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:


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