PDA

View Full Version : Doesn't always apply animation.


Dokins
15/04/2014, 10:38 PM
This animation isn't always applied. I can't seem to continuously force it, on each death.


This is how my death system works:

Player dies.

OnPlayerDeath
PlayerDead = 1;

OnPlayerUpdate
if(PlayerDead == 1)
PlayerDeath(playerid);


stock PlayerDeath(playerid)
{
SetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
printf("SetPOS");


SetPlayerHealth(playerid, 99999);

new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
new string[128];
format(string, sizeof(string), "D E A D\nB O D Y");
DeathLabel[playerid] = CreateDynamic3DTextLabel(string, COLOUR_REALRED, 0.0, 0.0, -0.5, 50.0, playerid, INVALID_VEHICLE_ID);
format(string, sizeof(string), "You have "COL_RED"died."COL_WHITE" Please assist players with the use of "COL_GREEN"'/do' "COL_WHITE"and do not "COL_RED"RK.");
SendClientMessage(playerid, COLOUR_WHITE, string);
SendClientMessage(playerid, COLOUR_GREY, "Depending on your cause of death, you may be revived. You must wait 3 minutes before you can '/accept death'.");
TextDrawShowForPlayer(playerid, DeadDraw[playerid]);
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 1, 0, 1);
DeathTimer[playerid] = 3;
PlayerDead[playerid] = 0;
return 1;
}


ONPLAYERDEATH

GetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
PlayerDead[playerid] = 1;



if(PlayerDead[playerid] == 1)
{
PlayerDeath(playerid);
}



If you have any ideas of doing this better/quicker/more effective I'm open to suggestion, but I'd be happy if someone could make the Animation force each time, it confuses me considerably.

DobbysGamertag
15/04/2014, 11:04 PM
Have you tried preloadanimlib? THIS (http://forum.sa-mp.com/showthread.php?t=284953&page=2) may help.

Dokins
16/04/2014, 12:10 AM
EDIT:

RESOLVED. Thank you for the help. That made me realise.

SOLUTION:


ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 1, 0, 1);


This loads from "KNIFE" Library

I forgot to preload "KNIFE" on player spawn.


PreloadAnimLib(playerid, "KNIFE");

Ke_NiReM
16/04/2014, 12:25 AM
Try This
ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);