Problem with animations
#1

I have to type the command for the animation twice before it applies the animation, how to fix this?
Reply
#2

You need to pre-load the animations on the first spawn.

pawn Код:
// global:
new bool: Player_PreloadAnim[MAX_PLAYERS char];

// OnPlayerConnect:
Player_PreloadAnim{playerid} = false;

// OnPlayerSpawn:
if (!Player_PreloadAnim{playerid})
{
    PreloadAnimLib(playerid, "DANCING");
    // add the function with the "animlib" you're using in order to pre-loaded
    // the above is just an example..
    Player_PreloadAnim{playerid} = true;
}

// function to pre-load
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0);
}
Reply
#3

Konstantinos's right, but if you want a quicker way to preload all anim libs (may cause lag on first spawn)
(Got this off a filterscript, made by [HuN]EpsiloN, it's not made by me.)
pawn Код:
// Not made by me - by [HuN]_Epsilon
new AnimLibraies[129][14] =
{
    "AIRPORT","Attractors","BAR","BASEBALL","BD_FIRE","BEACH","benchpress","BF_injection","BIKED","BIKEH",
    "BIKELEAP","BIKES","BIKEV","BIKE_DBZ","BLOWJOBZ","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"
};

public OnPlayerSpawn(playerid) {
    // [HuN]_Epsilon
    if (!GetPVarType(playerid, "anims_loaded")) {
        SetPVarInt(playerid, "anims_loaded", 1);
        for(new i; i < 129; ++i) ApplyAnimation(playerid, AnimLibraies[i], "null", 0.0, 0, 0, 0, 0, 0);
    }
    return 1;
}
Reply
#4

^All animations works now except the Carry animation, its not applying

This is how I try to apply it:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
Reply
#5

Quote:
Originally Posted by gychem
Посмотреть сообщение
^All animations works now except the Carry animation, its not applying

This is how I try to apply it:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
Well, that animation.. is applied with SetPlayerSpecialAction, not with ApplyAnimation...
The problem is... you need to do it 2 times, right?
Maybe...
pawn Код:
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE ); // 1st to clear all special actions
SetPlayerSpecialAction( playerid, SPECIAL_ACTION_CARRY ); // 2nd to make Carry animation on
if ( GetPlayerSpecialAction( playerid ) != SPECIAL_ACTION_CARRY ) { // Still not carrying, try to remove this check if still not working
    SetTimerEx("carry", 200, false, "i", playerid); // A timer to set carry animation
}

--
forward carry(playerid); public carry(playerid) return SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
That's what I came up with

If still not working, try to remove the getplayerspecialaction check and use the timer w/o checks.
Reply
#6

Its still not working it does the animation for like 1 second but then it auto dissapears :/
This is how I tried to fix it:

Код:
public MinerTimer(playerid)
{
	RemovePlayerAttachedObject(playerid, 3);
	SendClientMessage(playerid, -1, "{00FF00}Average {FFFFFF}metal produced. Take it to the refinery.");
	
	SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); // 1st to clear all special actions
	SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY); // 2nd to make Carry animation on
	ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0, 1);
	if ( GetPlayerSpecialAction( playerid ) != SPECIAL_ACTION_CARRY ) { // Still not carrying, try to remove this check if still not working
	    SetTimerEx("carry", 200, false, "i", playerid); // A timer to set carry animation
	}

//	SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
	
	
	SetPlayerAttachedObject(playerid, 4, 2936, 1, 0.184699, 0.426247, 0.000000, 259.531341, 80.949592, 0.000000, 0.476124, 0.468181, 0.470769);
	SetPlayerCheckpoint(playerid, -1866.611328, -1609.435546, 21.757812, 3.0);
	ExtraMetall[playerid] = 0;

return 1;
}

forward carry(playerid);
public carry(playerid)
{ 
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0, 1);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)