SA-MP Forums Archive
The anim not play - 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: The anim not play (/showthread.php?tid=587940)



The anim not play - Sn4ke2 - 04.09.2015

Hello all , i make a Command when type /cutwood to apply anim and give weapon | look:

PHP код:
CMD:cutwood(playerid,params[])
{
    if(
IsPlayerConnected(playerid))
    {
        if(
PlayerInfo[playerid][pJob] != 16) return SCM(playerid0xFFB870FF"{FFB870}Nu esti Lumberjack.");
        if(!
IsPlayerNearWood(playerid)) return SCM(playerid,COLOR_WHITE,"{FFF8C6}Nu esti la unul dintre copaci.");
        if(
woodtaie[playerid] == 0)
        {
            
GivePlayerWeapon(playerid,9,1);
            
ApplyAnimation(playerid,"CHAINSAW","WEAPON_csaw",4.1,1,0,0,0,1);
            
            
woodtaie[playerid] = 1;
            
SetTimerEx("WoodTaie",7000,false,"d",playerid);
        }
        else
        {
            
SendClientMessage(playerid,-1,"Tu tai deja un copac.");
        }
    }
    return 
1;

BUT the anim not play


Re: The anim not play - bgedition - 04.09.2015

You need to preload all the animation libraries you use first.
pawn Код:
stock PreloadAnimLib(playerid, animlib[])
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
Then put this under OnPlayerSpawn or so:
pawn Код:
PreloadAnimLib(playerid, "CHAINSAW");
You must do this for every animation you use to work all of them.


Re: The anim not play - itsCody - 04.09.2015

More easier way of preloading anims

PHP код:
// Somewhere in your script
static const AnimLibs[][] =
{
    
"BOMBER""RAPPING""SHOP""BEACH""SMOKING""FOOD""ON_LOOKERS",
    
"DEALER""CRACK""CARRY""COP_AMBIENT""PARK""INT_HOUSE""FOOD",
    
"DANCING""ped""TEC""CASINO""VENDING""HEIST9""PARACHUTE",
    
"GYMNASIUM""MISC""SWORD""CHAINSAW"
};
PreloadAnimLibFor(id)
{
    for(new 
0len sizeof(AnimLibs); leni++)
    {
        
ApplyAnimation(idAnimLibs[i], "null"0.0000000);
    }
}
// OnPlayerConnect
PreloadAnimLibFor(playerid); 
Probably better than his way, you'll be using way less lines if you want to preload more animations.