Animation problem
#1

Hey, i have a problem with my animation system. When a player connect on server, he have to do the 2 times one anim. If he use just one time the command, the server won't play the anim for user... I don't have any ideea how to fix it, maybe you can help me

Sorry for my bad english, Thank you for help.

Code
Код:
stock OnPlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
		if(PlayerInCar(playerid) || JackingEngine[playerid] != 0 || JackingLock[playerid] != 0 || Tazed{playerid} || Beanbag{playerid}) return 1;
		ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp, 1);
		OnAnim{playerid} = true;
		return 1;
	}
	return 0;
}
Example:
Код:
CMD:crossarms(playerid, params[])
{
	new type;
	if(sscanf(params,"d",type)) return SyntaxMSG(playerid, "/crossarms [1-2]");
    switch(type)
    {
		case 1: OnPlayAnim(playerid, "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1);
		case 2: OnPlayAnim(playerid,"OTB", "wtchrace_loop", 4.0, 1, 0, 0, 0, 0);
		default: SyntaxMSG(playerid, "/crossarms [1-2]");
    }
    return 1;
}
Reply
#2

I heard that you need to preload the animation library to fix this.
You can do it by using ApplyAnimation like you always do, just replace the animation's name with "null".
Reply
#3

You will need to preload the animations.

pawn Код:
// OnPlayerConnect:
PreloadAnimLib(playerid, "COP_AMBIENT");
PreloadAnimLib(playerid, "OTB");
...
pawn Код:
PreloadAnimLib(playerid, animlib[]) return ApplyAnimation(playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0);
EDIT: Sorry, didn't refresh the page.
Reply
#4

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
I heard that you need to preload the animation library to fix this.
You can do it by using ApplyAnimation like you always do, just replace the animation's name with "null".
I try your version. Now he don't do the animation.

Код:
stock OnPlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
		if(PlayerInCar(playerid) || JackingEngine[playerid] != 0 || JackingLock[playerid] != 0 || Tazed{playerid} || Beanbag{playerid}) return 1;
		ApplyAnimation(playerid, animlib, "null", Speed, looping, lockx, locky, lockz, lp, 1);
		OnAnim{playerid} = true;
		return 1;
	}
	return 0;
}
Edit:
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You will need to preload the animations.

pawn Код:
// OnPlayerConnect:
PreloadAnimLib(playerid, "COP_AMBIENT");
PreloadAnimLib(playerid, "OTB");
...
pawn Код:
PreloadAnimLib(playerid, animlib[]) return ApplyAnimation(playerid, animlib, "null", 0.0, 0, 0, 0, 0, 0);
EDIT: Sorry, didn't refresh the page.
I have this:
Код:
#define PreloadAnimLib(%1,%2)	ApplyAnimation(%1,%2,"null",0.0,0,0,0,0,0)
Код:
PreloadPlayerAnims(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");
}
Reply
#5

Quote:
Originally Posted by Hackzzzz
Посмотреть сообщение
I try your version. Now he don't do the animation.

Код:
stock OnPlayAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
		if(PlayerInCar(playerid) || JackingEngine[playerid] != 0 || JackingLock[playerid] != 0 || Tazed{playerid} || Beanbag{playerid}) return 1;
		ApplyAnimation(playerid, animlib, "null", Speed, looping, lockx, locky, lockz, lp, 1);
		OnAnim{playerid} = true;
		return 1;
	}
	return 0;
}
Edit:


I have this:
Код:
#define PreloadAnimLib(%1,%2)	ApplyAnimation(%1,%2,"null",0.0,0,0,0,0,0)
Код:
PreloadPlayerAnims(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");
}
That's the same thing I told you.
Reply
#6

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
That's the same thing I told you.
Yea, but still don't work..
Reply
#7

Quote:
Originally Posted by Hackzzzz
Посмотреть сообщение
Yea, but still don't work..
Do you even have PreloadAnimLib anywhere?
You can do it like this, let's say you want to apply an animation from library called "BOMBER", you do it like this:
Код:
PreloadAnimLib(playerid,"BOMBER");
ApplyAnimation(playerid, ... "BOMBER", animname)...
You got the idea. Or you can put these under OnPlayerConnect like Konstantinos said, not sure if it would work though.
Reply
#8

I haven't used it years now but you may try to preload them in OnPlayerSpawn - the first time the player spawns.
pawn Код:
new bool: gPlayer_FirstSpawn[MAX_PLAYERS char];

// OnPlayerConnect:
gPlayer_FirstSpawn{playerid} = false;

// OnPlayerSpawn:
if (!gPlayer_FirstSpawn{playerid})
{
    // preload animations..
    gPlayer_FirstSpawn{playerid} = true;
}

// rest of code.. from OnPlayerSpawn..
By the way COP_AMBIENT is preloaded but OTB not, so add it to the list.
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I haven't used it years now but you may try to preload them in OnPlayerSpawn - the first time the player spawns.
pawn Код:
new bool: gPlayer_FirstSpawn[MAX_PLAYERS char];

// OnPlayerConnect:
gPlayer_FirstSpawn{playerid} = false;

// OnPlayerSpawn:
if (!gPlayer_FirstSpawn{playerid})
{
    // preload animations..
    gPlayer_FirstSpawn{playerid} = true;
}

// rest of code.. from OnPlayerSpawn..
By the way COP_AMBIENT is preloaded but OTB not, so add it to the list.
You will laught . Still don't work... But this bug is from my script or from SA:MP development? I hate this "mini-bug", because when he try to use a anim he have to do to times in a row
Reply
#10

Up someone, with a suggestion?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)