ApplyAnimation works after 2nd call only
#1

Hello,

I got a little problem. I have some ApplyAnimation() functions in my script and after entering the command to execute them the first time nothing happens. When I enter the command afterwards it works fine all the time.

So basically just the first call of ApplyAnimation ends in "Do-Nothing".

Any suggestions? Here is a little extract of how the ApplyAnimation functions work.

Код:
dcmd_arrest(playerid,params[])
{
	#pragma unused params
	ApplyAnimation( playerid,"ped", "ARRESTgun", 4.0, 0, 0, 0, 1, 0,1);
	SetPVarInt(playerid,"IsAnimated",1);

	return 1;
}

dcmd_arrested(playerid,params[])
{
	#pragma unused params
	ApplyAnimation(playerid, "POLICE", "crm_drgbst_01", 4.0, 0, 0, 0, 1, 0,1);
	SetPVarInt(playerid,"IsAnimated",1);

	return 1;
}

dcmd_bleeding(playerid,params[])
{
	#pragma unused params
	ApplyAnimation(playerid, "SWEET", "Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0,1);
	SetPVarInt(playerid,"IsAnimated",1);

	return 1;
}

dcmd_crossarms(playerid,params[])
{
	#pragma unused params
	ApplyAnimation(playerid, "COP_AMBIENT", "Coplook_loop", 4.0, 1, 0, 0, 0, 0,1);
	SetPVarInt(playerid,"IsAnimated",1);

	return 1;
}

dcmd_crack(playerid,params[])
{
	#pragma unused params
	ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0,1);
	SetPVarInt(playerid,"IsAnimated",1);

	return 1;
}
Reply
#2

Put this at OnPlayerSpawn (ofcourse adding your own animation libraries)
pawn Код:
PreloadAnimLib(playerid, "PED");
    PreloadAnimLib(playerid, "OTB");
    PreloadAnimLib(playerid, "PAULNMAC");
    PreloadAnimLib(playerid, "VENDING");
    PreloadAnimLib(playerid, "INT_SHOP");
    PreloadAnimLib(playerid, "BOMBER");
And you need this stock:
pawn Код:
stock PreloadAnimLib(playerid, animlib[])
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
Reply
#3

Thanks, I'll try it in a few minutes.

Is it enough to put in OnPlayerSpawn and execute it just after the first spawn (after OnPlayerConnect) or everytime OnPlayerSpawn is called?

EDIT:

Just tested it, it works very fine. Thank you very much, Rep++!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)