SA-MP Forums Archive
Doesn't always apply animation. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Doesn't always apply animation. (/showthread.php?tid=507079)



Doesn't always apply animation. - Dokins - 15.04.2014

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);

pawn Код:
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
pawn Код:
GetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
    PlayerDead[playerid] = 1;
pawn Код:
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.


Re: Doesn't always apply animation. - DobbysGamertag - 15.04.2014

Have you tried preloadanimlib? THIS may help.


Re: Doesn't always apply animation. - Dokins - 15.04.2014

EDIT:

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

SOLUTION:

pawn Код:
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.

pawn Код:
PreloadAnimLib(playerid, "KNIFE");



Re: Doesn't always apply animation. - Ke_NiReM - 15.04.2014

Try This
pawn Код:
ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);