Clear Animation after IDLE_CHAT OnPlayerText
#1

Is it possible to clear chat after the chat animation (without freeze) OnPlayerText?
i try with Timer but after the animation playing the arms are stuck and cannot move. the arm can move after i jump.

code

pawn Код:
new TalkTimer[MAX_PLAYERS];
new length = strlen(text);
new ctime = length*50;
ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.1, 0, 0, 0, 1, ctime);
TalkTimer[playerid] = SetTimerEx("ClearTalkAnim", ctime, true, "d", playerid);

forward ClearTalkAnim(playerid);
public ClearTalkAnim(playerid)
{
    ClearAnimations(playerid);
    KillTimer(TalkTimer[playerid]);
    return 1;
}
Reply
#2

It's not wrong with OnPlayerText, just with ApplyAnimation. One number changed (I will edit this post in a moment, I will find ingame) and you will be unfreezed and you won't need to use a timer.

EDIT:

Use this code to make it work (works perfectly for me).

pawn Код:
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,0,0,1,4);
I didn't test with that how long is the text, so you can edit by yourself.
Reply
#3

up up!
Reply
#4

bump!
Reply
#5

You don't need any timer or anything beside the ApplyAnimation function. Here is the correct version:
pawn Код:
ApplyAnimation(playerid,"PED","IDLE_CHAT",4.1,0,0,0,0,ctime);
Now, the parameter before 'ctime' it's the freeze the character after the animation is over. If it's set to 1, the character will be "freezed" after the animation ends. So, in your case, you'll need to set it to 0. Now, don't forget to delete the timer.

For more info, don't hesitate to check this site:
https://sampwiki.blast.hk/wiki/ApplyAnimation
Reply
#6

but it little annoys me example

when ever i type "Hey dude sup" it will stop my running animation then play the animation then runs again.
i just simply want to know how to clear animation after his talking animation is finish. otherwise i will use antonio trick for now until someone reply
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)