Animation on death not working. -
Twistedz - 20.09.2016
Well, i've been improving my death system recently, then i faced a problem, took me 2 hours and still i cannot fix it.
When a player dies, if he isn't in the heavily injured status, he will be dropped (In a sleeping animation) on the ground, and frozen.
But what happens is, everything is fine, skin is fine, freezing is fine, expect the animation, it doesn't happen AT ALL. >.>
Here, i'll show my OnPlayerSpawn, and OnPlayerDeath callbacks.
OnPlayerSpawn:
Код:
if(pInfo[playerid][Injured] == 1)
{
SetPlayerPos(playerid,pInfo[playerid][XPos],pInfo[playerid][YPos],pInfo[playerid][ZPos]);
SetPlayerFacingAngle(playerid,pInfo[playerid][Angle]);
SetPlayerDrunkLevel(playerid,4999);
SetPlayerSkin(playerid,pInfo[playerid][Skin]);
GameTextForPlayer(playerid, "~r~Heavily injured.", 600000, 6);
ApplyAnimation(playerid, "CRACK", "crckdeth4",4.1,0,0,0,1,1);
SetPlayerHealth(playerid,25);
SetTimerEx("Reducedeathhp",30000,true,"i",playerid);
TogglePlayerControllable(playerid,0);
OnPlayerDeath:
Код:
GetPlayerPos(playerid,pInfo[playerid][XPos],pInfo[playerid][YPos],pInfo[playerid][ZPos]);
GetPlayerFacingAngle(playerid,pInfo[playerid][Angle]);
pInfo[playerid][Skin] = GetPlayerSkin(playerid);
if(pInfo[playerid][Injured] == 0)
{
pInfo[playerid][Injured] = 1;
}
else if(pInfo[playerid][Injured] == 1)
{
pInfo[playerid][Injured] = 0;
}
Also, if anyone can give me exact death(sleep) animation? >.>
Thank you.
Re: Animation on death not working. -
Kaliber - 20.09.2016
The point is, when you freeze a player...the animation gets unloaded
So...dont freeze him, use the freeze Parameter in the Animation
https://sampwiki.blast.hk/wiki/ApplyAnimation
Greekz
Re: Animation on death not working. -
Twistedz - 20.09.2016
Yes, you are basically right, but the freeze parameter in the animation will more likely freeze the character of the player, not himself, so when i press F/SHIFT i can freely move. That's my problem.
Thank you, anyway.
Re: Animation on death not working. -
Kaliber - 20.09.2016
Yes, thats a real problem
A trick would be...to check over the key states if he press for Example F...and then...freeze him...
unfreeze him..and set the animation again
This solves these Problems

Maybe set his position new or sth like that xD
Re: Animation on death not working. -
Twistedz - 20.09.2016
So that's the only solution for my problem? xd <.>
Re: Animation on death not working. -
Threshold - 21.09.2016
Код:
ApplyAnimation(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync)
Your 'time' parameter is set to 1... meaning that the animation will end after 1 millisecond. Which you can probably guess is not a lot of time...
Try this:
PHP код:
ApplyAnimation(playerid, "CRACK", "crckdeth4", 4.1, 1, 1, 1, 0, 0, 1);
Also, make sure you are preloading your animation libraries before using any animations. Search for 'PreloadAnimLib'.
Re: Animation on death not working. -
Twistedz - 21.09.2016
Then, i do put all of the animation preloads function in OnPlayerConnect? those i mean.
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" );
Re: Animation on death not working. -
Threshold - 21.09.2016
Well you want to put it somewhere that will be called before you apply any animations to a player.