• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] [Solved] GetAnimationName() is not working properly
#1
SOLUTION:

Store that animation lib and name in a variable.

e.g. :

Code:
new rAnimLib[MAX_PLAYERS][20];

new rAnimName[MAX_PLAYERS][20];



COMMAND:anim(playerid, params[]) {

? ? ApplyAnimation(playerid, "PED", "IDLE_STANCE", 4.1, 0, 0, 0, 0, 0);

? ? rAnimLib[playerid] = "PED";

? ??rAnimName[playerid] = "IDLE_STANCE";

? ? return 1;

}



GetAnimationNameEx(playerid, Lib[20], Name[20])

{

? ? Lib = rAnimLib[playerid];

? ? Name = rAnimName[playerid];

}

//use this method instead of GetAnimationName.





I use GetAnimationName() function but it only returns PED, IDLE_STANCE or PED,SEAT_IDLE or PED,WOMAN_IDLESTANCE.



When i apply another animations like /eat, /sit, /lay

this function not give me the applied animation animlib and animname but just return PED, IDLE_STANCE.



PHP Code:
ApplyAnimation(playerid,"BEACH","Lay_Bac_Loop",4.1011111); // Sit

ApplyAnimation(playerid,"BEACH""bather",4.1011111); // Lay down



CMD:anim(playerid) {

? ? if(
GetPlayerAnimationIndex(playerid))

{

? ? new 
animlib[32];

? ? new 
animname[32];

? ? new 
msg[128];? ? 

? ? 
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);

? ? 
format(msg128"Running anim: %s %s"animlibanimname);

? ? 
SendClientMessage(playerid, -1msg); // output is: PED IDLE_STANCE

}

? ? return 
1;





In other gamemodes that I test, this problem does not occur.



I need to fix this problem quickly.

thanks for the anyone answer.
  Reply
#2
Bump



Does the lagcomp 0 have an effect on this function?
  Reply
#3
Changing the time value fixed this.
I changed it to 4000:
PHP Code:
ApplyAnimation(playerid,"BEACH","Lay_Bac_Loop"4.1011140001); 

The only issue is that you can't exit the animation until 4 seconds (4000 ms) pass.

EDIT: After those 4 seconds, GetAnimationName gives PED, IDLE_STANCE so this won't help you much.
You can lock a player and then check if he pressed ENTER and cancel the animation or something like that.
  Reply


Forum Jump: