SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/07/2015, 02:21 AM   #1
SkullFire
High-roller
 
SkullFire's Avatar
 
Join Date: Nov 2012
Posts: 1,223
Reputation: 118
Default Actor animation

Hey there.
Well, my actors doesn't load animations at first(OnGameModeInit)
I've preloaded before with the code from someone i do not remember who did this. well, see...

On top of gamemode
PHP Code:
static s_AnimationLibraries[][] = {
        !
"AIRPORT",    !"ATTRACTORS",   !"BAR",                 !"BASEBALL",
        !
"BD_FIRE",    !"BEACH",            !"BENCHPRESS",  !"BF_INJECTION",
        !
"BIKED",          !"BIKEH",        !"BIKELEAP",        !"BIKES",
        !
"BIKEV",          !"BIKE_DBZ",     !"BMX",             !"BOMBER",
        !
"BOX",            !"BSKTBALL",     !"BUDDY",           !"BUS",
        !
"CAMERA",         !"CAR",          !"CARRY",           !"CAR_CHAT",
        !
"CASINO",         !"CHAINSAW",     !"CHOPPA",          !"CLOTHES",
        !
"COACH",          !"COLT45",       !"COP_AMBIENT", !"COP_DVBYZ",
        !
"CRACK",          !"CRIB",         !"DAM_JUMP",         !"DANCING",
        !
"DEALER",         !"DILDO",        !"DODGE",            !"DOZER",
        !
"DRIVEBYS",   !"FAT",          !"FIGHT_B",      !"FIGHT_C",
        !
"FIGHT_D",    !"FIGHT_E",      !"FINALE",               !"FINALE2",
        !
"FLAME",      !"FLOWERS",      !"FOOD",                 !"FREEWEIGHTS",
        !
"GANGS",      !"GHANDS",       !"GHETTO_DB",    !"GOGGLES",
        !
"GRAFFITI",   !"GRAVEYARD",    !"GRENADE",      !"GYMNASIUM",
        !
"HAIRCUTS",   !"HEIST9",       !"INT_HOUSE",    !"INT_OFFICE",
        !
"INT_SHOP",   !"JST_BUISNESS", !"KART",                 !"KISSING",
        !
"KNIFE",      !"LAPDAN1",              !"LAPDAN2",      !"LAPDAN3",
        !
"LOWRIDER",   !"MD_CHASE",     !"MD_END",               !"MEDIC",
        !
"MISC",       !"MTB",                  !"MUSCULAR",     !"NEVADA",
        !
"ON_LOOKERS", !"OTB",                  !"PARACHUTE",    !"PARK",
        !
"PAULNMAC",   !"PED",                  !"PLAYER_DVBYS", !"PLAYIDLES",
        !
"POLICE",     !"POOL",                 !"POOR",                 !"PYTHON",
        !
"QUAD",       !"QUAD_DBZ",     !"RAPPING",      !"RIFLE",
        !
"RIOT",       !"ROB_BANK",     !"ROCKET",               !"RUSTLER",
        !
"RYDER",      !"SCRATCHING",   !"SHAMAL",               !"SHOP",
        !
"SHOTGUN",    !"SILENCED",     !"SKATE",                !"SMOKING",
        !
"SNIPER",     !"SPRAYCAN",     !"STRIP",                !"SUNBATHE",
        !
"SWAT",       !"SWEET",                !"SWIM",                 !"SWORD",
        !
"TANK",       !"TATTOOS",              !"TEC",                  !"TRAIN",
        !
"TRUCK",      !"UZI",                  !"VAN",                  !"VENDING",
        !
"VORTEX",     !"WAYFARER",     !"WEAPONS",      !"WUZI",
        !
"WOP",        !"GFUNK",                !"RUNNINGMAN"
};

stock static PreloadActorAnimations(actorid)
{
        for(new 
0sizeof(s_AnimationLibraries); ++)
        {
            
ApplyActorAnimation(actorids_AnimationLibraries[i], "null"0.000000);
        }
}

new 
ActorMercadoNActorNinho
OnGameModeInit
PHP Code:
    ActorMercadoN CreateActor(1622355.0710,-648.2926,128.0547,91.2342);
    
PreloadActorAnimations(ActorMercadoN);
    
ActorNinho CreateActor(332686.4758,-1425.5580,16.2500,194.1172);
    
PreloadActorAnimations(ActorNinho);


    
ApplyActorAnimation(ActorMercadoN"INT_SHOP""shop_lookA"4.110000);
    
ApplyActorAnimation(ActorNinho"COP_AMBIENT""Coplook_loop"4.110000); 
To test if animation is working, i did this command :
PHP Code:
CMD:test(playerid)
{
ApplyActorAnimation(ActorNinho"COP_AMBIENT""Coplook_loop"4.110000);
ApplyActorAnimation(ActorMercadoN"INT_SHOP""shop_lookA"4.110000);
return 
1;

and yes, it's working.
__________________
Darkness is coming...

SkullFire is offline   Reply With Quote
Old 26/07/2015, 02:26 AM   #2
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,524
Reputation: 437
Default Re: Actor animation

Your code is silly! Why do actors need to have animations preloaded? They aren't clients, they aren't real people, they don't need to see their own animations. You need to preload the animation for the player that's going to be viewing the animation, not the actual actor.
Abagail is offline   Reply With Quote
Old 26/07/2015, 02:33 AM   #3
SkullFire
High-roller
 
SkullFire's Avatar
 
Join Date: Nov 2012
Posts: 1,223
Reputation: 118
Default Re: Actor animation

I'm applying an animation him for players can see he.Is that not the right way?

@sorry, bad english .-.
__________________
Darkness is coming...

SkullFire is offline   Reply With Quote
Old 26/07/2015, 02:45 AM   #4
Onfroi
High-roller
 
Onfroi's Avatar
 
Join Date: Jan 2012
Location: Dallas, Texas
Posts: 1,702
Reputation: 215
Default Re: Actor animation

What's the point of the PreloadActorAnimations function? Just use ApplyActorAnimation in OnGameModeInit.
__________________


Onfroi is offline   Reply With Quote
Old 26/07/2015, 02:47 AM   #5
SkullFire
High-roller
 
SkullFire's Avatar
 
Join Date: Nov 2012
Posts: 1,223
Reputation: 118
Default Re: Actor animation

Quote:
Originally Posted by Onfroi View Post
What's the point of the PreloadActorAnimations function? Just use ApplyActorAnimation in OnGameModeInit.
Same shit.
I will use that \/ , maybe works...
http://wiki.sa-mp.com/wiki/OnActorStreamIn
__________________
Darkness is coming...

SkullFire is offline   Reply With Quote
Old 26/07/2015, 02:51 AM   #6
Abagail
High-roller
 
Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,524
Reputation: 437
Default Re: Actor animation

Well if this code
Code:
 ActorMercadoN = CreateActor(162, 2355.0710,-648.2926,128.0547,91.2342); 
    PreloadActorAnimations(ActorMercadoN); 
    ActorNinho = CreateActor(33, 2686.4758,-1425.5580,16.2500,194.1172); 
    PreloadActorAnimations(ActorNinho); 


    ApplyActorAnimation(ActorMercadoN, "INT_SHOP", "shop_lookA", 4.1, 1, 0, 0, 0, 0); 
    ApplyActorAnimation(ActorNinho, "COP_AMBIENT", "Coplook_loop", 4.1, 1, 0, 0, 0, 0);

Is in OnGameModeInit, your not doing it right because not all players are near and NO players are even connected at the time the callback is called. Try doing something such as this:

Code:
new actorAnimPreloaded;
public OnPlayerSpawn(playerid) {
    if(!actorAnimPreloaded) {
         ApplyAnimation(playerid, "INT_SHOP", "shop_lookA", 4.1, 1, 0, 0, 0, 0); 
         ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_loop", 4.1, 1, 0, 0, 0, 0);
         actorAnimPreloaded = 1;
         return 1;
     }

     return 1;
}
Abagail is offline   Reply With Quote
Old 26/07/2015, 03:03 AM   #7
SkullFire
High-roller
 
SkullFire's Avatar
 
Join Date: Nov 2012
Posts: 1,223
Reputation: 118
Default Re: Actor animation

Quote:
Originally Posted by Abagail View Post
Well if this code
Code:
 ActorMercadoN = CreateActor(162, 2355.0710,-648.2926,128.0547,91.2342); 
    PreloadActorAnimations(ActorMercadoN); 
    ActorNinho = CreateActor(33, 2686.4758,-1425.5580,16.2500,194.1172); 
    PreloadActorAnimations(ActorNinho); 


    ApplyActorAnimation(ActorMercadoN, "INT_SHOP", "shop_lookA", 4.1, 1, 0, 0, 0, 0); 
    ApplyActorAnimation(ActorNinho, "COP_AMBIENT", "Coplook_loop", 4.1, 1, 0, 0, 0, 0);

Is in OnGameModeInit, your not doing it right because not all players are near and NO players are even connected at the time the callback is called. Try doing something such as this:

Code:
new actorAnimPreloaded;
public OnPlayerSpawn(playerid) {
    if(!actorAnimPreloaded) {
         ApplyAnimation(playerid, "INT_SHOP", "shop_lookA", 4.1, 1, 0, 0, 0, 0); 
         ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_loop", 4.1, 1, 0, 0, 0, 0);
         actorAnimPreloaded = 1;
         return 1;
     }

     return 1;
}
Why ApplyAnimation in myself ?
__________________
Darkness is coming...

SkullFire is offline   Reply With Quote
Old 26/07/2015, 06:03 AM   #8
Onfroi
High-roller
 
Onfroi's Avatar
 
Join Date: Jan 2012
Location: Dallas, Texas
Posts: 1,702
Reputation: 215
Default Re: Actor animation

Quote:
Originally Posted by SkullFire View Post
Why ApplyAnimation in myself ?
You don't have to preload the animations. Look at https://wiki.sa-mp.com/wiki/ApplyActorAnimation
__________________


Onfroi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Actor Animation - It does not work the first norton2 Scripting Help 6 25/05/2015 04:55 PM
Actor animation desync MP2 Scripting Help 13 28/04/2015 08:53 AM
[REQUEST]Animation ID for the fall back animation IKnowWhatIAmDoing Scripting Help 9 03/08/2014 06:51 AM
How to make animation affect only part of the body? (a.k.a walking during animation) gangsta15 Scripting Help 3 09/09/2011 04:38 PM
Car doors locked animation (Need help to apply animation) yugokoral Help Archive 0 20/09/2009 06:00 PM


All times are GMT. The time now is 10:05 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.