Anim with timer help please.
#1

I made a fishing system with anim after /fish
but after he does it the player got stuck with the animation

TogglePlayerControllable(playerid, 0);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0, 1,0,1,1);
SetTimer("FishAnim", 1000, 0);


and this is the timer

public FishAnim(playerid)
{
OnePlayAnim(playerid, "CARRY", "crry_prtial", 5.0, 0, 0, 0, 0, 1);
ClearAnimations(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
Reply
#2

Not suprised - You froze him here:

pawn Код:
TogglePlayerControllable(playerid, 0);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0, 1,0,1,1);
SetTimer("FishAnim", 1000, 0);
Change that 0 to a 1 on TogglePlayerControllable.
Reply
#3

@phillip875 he did everything* right.

Here is the fix btw
pawn Код:
SetTimerEx("FishAnim",1000,false,"i",playerid);
Reply
#4

Thanks
but now he doesnt freeze but the first anim still on the other not..
Reply
#5

pawn Код:
TogglePlayerControllable(playerid, 0);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0, 1,0,1,1);
ClearAnimations(playerid);
SetTimer("FishAnim", 1000, 0);
That should clear the first animation, before switching to your fishing.
Reply
#6

thanks.
how can i change the speed of the anims the player doing it so fast.
Reply
#7

Hmm.... here is the fix.

pawn Код:
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid,"SWORD","sword_block",50.0,0, 1,0,1000,1);
SetTimerEx("FishAnim",2000,false,"i",playerid);
pawn Код:
forward FishAnim(playerid);

public FishAnim(playerid)
{
    TogglePlayerControllable(playerid, 1);
    ClearAnimations(playerid,1);
    ApplyAnimation(playerid, "CARRY", "crry_prtial", 5.0, 0, 0, 1, 100, 1);
    return 1;
}
Edit : To decrease speed
ApplyAnimation(playerid, animlib[], animname[],SPEED, loop, lockx, locky, freeze, time, forcesync);

Decrease this
Reply
#8

Always use SetTimerEx For player timers.
Reply
#9

Thanks for the help guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)