Posts: 91
Threads: 9
Joined: Mar 2012
Reputation:
0
hi all
i wanna know if there is a possibility to call a function after finishing animation. for sure i could manage it with a timer but that would be a nasty, difficult and very inaccurate sollution.
greetz
Posts: 6,129
Threads: 36
Joined: Jan 2009
Without a timer, no.
You could hook a timer to the 'time' parameter in ApplyAnimation, and have a function execute when the 'time' value reaches 0 though.
Something like this:
pawn Код:
ApplyAnimationWithTimer(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync, function[]) {
ApplyAnimation(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync);
SetTimer(function, time, false);
return 1;
}
Posts: 91
Threads: 9
Joined: Mar 2012
Reputation:
0
quite ugly way - hope there will be some changes in next samp version. thanks calgon but what exactly is that "timer" parameter? "Timer in milliseconds. For a never ending loop it should be 0." doesnt say anything
Posts: 6,129
Threads: 36
Joined: Jan 2009
That explains everything... The amount of milliseconds the animation will execute for?
Posts: 91
Threads: 9
Joined: Mar 2012
Reputation:
0
fDelta is supposed to change that "fDelta - The speed to play the animation." - the highter fDelta is (loop = 0) the shorter the animationtime is isnt it?