SA-MP Forums Archive
Need help with animations. - 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: Need help with animations. (/showthread.php?tid=484757)



Need help with animations. - renegadegaming - 01.01.2014

Hello!

animations play a big role in my gamemode and it is crucial that they trigger as soon as you use the command.
However now, when I use the command to trigger an animation it needs to be done twice for the animation to work (first time).

Any ideas how to make it work like it should?


Re: Need help with animations. - McBan - 01.01.2014

Put the code where it says ApplyAnimation( bla bla ), Do that twice, No idea why but that should solve it


Re: Need help with animations. - renegadegaming - 01.01.2014

Thank you!


Re: Need help with animations. - Threshold - 01.01.2014

Quote:
Originally Posted by =WoR=Varth
pawn Код:
PreloadAnimLib(playerid,"BOMBER");
PreloadAnimLib(playerid,"RAPPING");
PreloadAnimLib(playerid,"SHOP");
PreloadAnimLib(playerid,"BEACH");
PreloadAnimLib(playerid,"SMOKING");
PreloadAnimLib(playerid,"FOOD");
PreloadAnimLib(playerid,"ON_LOOKERS");
PreloadAnimLib(playerid,"DEALER");
PreloadAnimLib(playerid,"CRACK");
PreloadAnimLib(playerid,"CARRY");
PreloadAnimLib(playerid,"COP_AMBIENT");
PreloadAnimLib(playerid,"PARK");
PreloadAnimLib(playerid,"INT_HOUSE");
PreloadAnimLib(playerid,"FOOD" );
PreloadAnimLib(playerid,"PED" );
Quote:
Originally Posted by Stigg
pawn Код:
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
So your code should be something like this:
pawn Код:
public OnPlayerSpawn(playerid)
{
    PreloadAnimLib(playerid,"BOMBER");
    PreloadAnimLib(playerid,"RAPPING");
    PreloadAnimLib(playerid,"SHOP");
    PreloadAnimLib(playerid,"BEACH");
    PreloadAnimLib(playerid,"SMOKING");
    PreloadAnimLib(playerid,"FOOD");
    PreloadAnimLib(playerid,"ON_LOOKERS");
    PreloadAnimLib(playerid,"DEALER");
    PreloadAnimLib(playerid,"CRACK");
    PreloadAnimLib(playerid,"CARRY");
    PreloadAnimLib(playerid,"COP_AMBIENT");
    PreloadAnimLib(playerid,"PARK");
    PreloadAnimLib(playerid,"INT_HOUSE");
    PreloadAnimLib(playerid,"FOOD" );
    PreloadAnimLib(playerid,"PED" );
    return 1;
}

PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
Animations need to be 'loaded' in a sense, before they can be used. By applying a 'null' or empty animation from each of the categories, you are loading the animations for future use. So therefore, when you go to use an animation, it has already been loaded and will work on the first try.