OnPlayerAnimationEnd(); based on animation length
#1

Hello guys, i have a little question. Is it possible to dump all animations length from game archives to an array for best animation time accuracy and future using it in custom function "ApplyAnimationEx();" (for example), that triggers custom callback "OnPlayerAnimationEnd", after animation end?

Sorry for my bad English. I hope you undestand me :3
Reply
#2

Quote:
Originally Posted by SerejaN
Посмотреть сообщение
Sorry for my bad English. I hope you undestand me :3
You can do this easily:

PHP код:
new bool:aCheck[MAX_PLAYERS char],aIDX[MAX_PLAYERS];
//Under OnPlayerUpdate
switch(aCheck{playerid}) {
    case 
true: {
        if(!
GetPlayerAnimationIndex(playerid)) OnPlayerAnimationEnd(playerid,aIDX[playerid]),aCheck{playerid}=false;
    }
    case 
false: {
        if(
GetPlayerAnimationIndex(playerid)) {
            
aCheck{playerid} = true;
            
aIDX[playerid] = GetPlayerAnimationIndex(playerid);
        }
    }
}
//In the Script:
stock OnPlayerAnimationEnd(playerididx)
{
    new 
animlib[32],animname[32],msg[128];
    
GetAnimationName(idx,animlib,32,animname,32);
    
format(msg128"Anim ended: %s %s"animlibanimname);
    
SendClientMessage(playerid0xFFFFFFFFmsg);
    return 
1;

If you don't like OnPlayerUpdate, use a timer..with ~150ms
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)