SA-MP Forums Archive
Anim with timer help please. - 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: Anim with timer help please. (/showthread.php?tid=354969)



Anim with timer help please. - PaulDinam - 28.06.2012

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


Re: Anim with timer help please. - phillip875 - 28.06.2012

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.


Re: Anim with timer help please. - [MM]RoXoR[FS] - 28.06.2012

@phillip875 he did everything* right.

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



Re: Anim with timer help please. - PaulDinam - 28.06.2012

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


Re: Anim with timer help please. - phillip875 - 28.06.2012

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.


Re: Anim with timer help please. - PaulDinam - 28.06.2012

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


Re: Anim with timer help please. - [MM]RoXoR[FS] - 28.06.2012

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


Re: Anim with timer help please. - Littlehelper - 28.06.2012

Always use SetTimerEx For player timers.


Re: Anim with timer help please. - PaulDinam - 28.06.2012

Thanks for the help guys