SA-MP Forums Archive
functioncall after finished animation - 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: functioncall after finished animation (/showthread.php?tid=371196)



functioncall after finished animation - Kwashiorkor - 22.08.2012

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


Re: functioncall after finished animation - Calgon - 22.08.2012

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;
}



AW: functioncall after finished animation - Kwashiorkor - 22.08.2012

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


Re: functioncall after finished animation - Calgon - 22.08.2012

That explains everything... The amount of milliseconds the animation will execute for?


AW: functioncall after finished animation - Kwashiorkor - 22.08.2012

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?