Animation problem -
Mijata - 16.01.2017
Im trying to make when player got killed from other player, he do animation and then die but not working...
PHP код:
forward anim(playerid);
public anim(playerid)
{
ClearAnimations(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetTimerEx("anim", 10000, false, "i", playerid);
ApplyAnimation(playerid, "PED", "KO_shot_front",4.1,0,1,1,1,1);
Re: Animation problem -
GoldenLion - 16.01.2017
What you can do is add a serversided health system and custom death.
Re: Animation problem -
azzerking - 16.01.2017
Quote:
Originally Posted by GoldenLion
What you can do is add a serversided health system and custom death.
|
This is by far the furthest thing away from what he actually asked for.
- OT -
I believe whats happening is your being respawned faster then when the animation can be applied. As you know when you die, you go through the process of being respawned.
So your animation is being canceled, as well as your timer function is probably doing nothing, since you can't cancel animation that already been canceled and when your going through the process of being spawned.
You need to delay the player from dying, use
OnPlayerTakeDamage and try and detect if the player's health has gone below 1 and then apply the animation. Maybe that will work.
Re: Animation problem -
GoldenLion - 16.01.2017
Quote:
Originally Posted by azzerking
This is by far the furthest thing away from what he actually asked for.
|
Yes, but it's the only way. It's not possible to apply or clear any animations on death as far as I know.
Re: Animation problem -
Hansrutger - 16.01.2017
Correct, but it is after dying. Then again, if you really don't want to do it like this (the example below) then don't, once a player is dead, they are dead and you can't do much about it afaik.
Код:
#define STATE_ALIVE 0
#define STATE_DEATH 1
//or
enum {
STATE_ALIVE,
STATE_DEAD
};
public OnPlayerDeath(playerid, killerid, reason)
{
pInfo[playerid][pState] = STATE_DEAD;
}
public OnPlayerUpdate(playerid)
{
new animindex = GetPlayerAnimationIndex(playerid);
if (NUMBER != animindex)
{
ApplyAnimation(...);
}
}
CMD:iamstonedead(playerid, params[])
{
pInfo[playerid][pState] = STATE_ALIVE;
return 1;
}
This is just a start of course, you will have to build up something more advanced if you would like something fancy. "NUMBER" is the animindex of an animation, basically it tells you if the player is currently in a specific animation. You'll have to figure out that one on your own as I'm not really going to list all of them (I don't know them in and out obviously).
Example for animindex:
"SWAT" - "gnstwall_injurd"
This has animation index 1508