SA-MP Forums Archive
Animation problem - 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: Animation problem (/showthread.php?tid=579477)



Animation problem - ShoortyFl - 27.06.2015

IDK what is going on, i'm trying to implement animations to my script and they're not working for example:


pawn Код:
CMD:cop(playerid, params[]) { OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1); return 1; }
Is not working while this one does work

pawn Код:
CMD:carjacked1(playerid, params[]) { LoopingAnim(playerid,"PED","CAR_jackedLHS",4.0,0,1,1,1,0); return 1; }

pawn Код:
OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    if (gPlayerUsingLoopingAnim[playerid] == 1)
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    animation[playerid]++;
}

LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    if (gPlayerUsingLoopingAnim[playerid] == 1)
    gPlayerUsingLoopingAnim[playerid] = 1;
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    animation[playerid]++;
}

StopLoopingAnim(playerid)
{
    gPlayerUsingLoopingAnim[playerid] = 0;
    ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}

PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}



Re: Animation problem - Ritzy2K - 27.06.2015

Why dont you simply apply animation?


Re: Animation problem - ShoortyFl - 27.06.2015

Because with Apply animation you have to apply nearly every animation twice before it works.


Re: Animation problem - Youssef221 - 27.06.2015

With 1 ApplyAnimation function, the animation might not work, so try this:

pawn Код:
OnePlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    if (gPlayerUsingLoopingAnim[playerid] == 1)
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
        ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
        ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    animation[playerid]++;
}

LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
    if (gPlayerUsingLoopingAnim[playerid] == 1)
    gPlayerUsingLoopingAnim[playerid] = 1;
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
    animation[playerid]++;
}

StopLoopingAnim(playerid)
{
    gPlayerUsingLoopingAnim[playerid] = 0;
    ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
    ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
    ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}

PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
        ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
        ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}



Re: Animation problem - ShoortyFl - 27.06.2015

Yes now it works, but i have to type /cop 2 times for it to actually work


Re: Animation problem - Youssef221 - 27.06.2015

Quote:
Originally Posted by ShoortyFl
Посмотреть сообщение
Yes now it works, but i have to type /cop 2 times for it to actually work
Try this:
pawn Код:
CMD:cop(playerid, params[])
{
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
OnePlayAnim(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
return 1;
}