Deathmode doesn't perform animation
#1

So basically, I have seen in a gamemode a deathmode alike LS-RP so I took apart of it (the dead mode) and implemented it into my gamemode and changed a bit, problem is, when I execute a player in-game he stands up from the injury animation and doesn't peform the animation I have given him at the dead mode: ( code )

PHP код:
function:OnPlayerDead(playeridkilleridreasonexecuted)
{
    if(
executed == 1)
    {
        
SendAdminAction(playerid"%s has been executed by %s. (%s)"ReturnName(playerid), ReturnName(killerid), ReturnWeaponName(reason)); 
    }
    
SetPlayerTeam(playeridPLAYER_STATE_DEAD); 
    
PlayerData[playerid][pRespawnTime] = gettime(); 
    
SendClientMessage(playeridCOLOR_YELLOWEX"-> You're now dead. You need to wait 60 seconds until you can /respawnme."); 
    
ClearAnimations(playerid);
    for(new 
=0<4i++)
    
ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1);
    
SetPlayerWeather(playeridglobalWeather);
    
TogglePlayerControllable(playerid0);
    
ResetWeapons(playerid);
    return 
1;

Reply
#2

Im not sure about it but maybe TogglePlayerControllable(playerid, 0); might clear the animation.
Also, try to put this twice, was a problem on my server too sometimes aswell.:
Код:
for(new i =0; i <4; i++) 
    ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1); 
    ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0,1,1,1,0,1); 
    SetPlayerWeather(playerid, globalWeather); 
    TogglePlayerControllable(playerid, 0); 
    ResetWeapons(playerid);
And why do you have ClearAnimations(playerid); ?
All previous animations will be automaticly cleared when using a new anim as far as i know.
Reply
#3

OnPlayerDead calls OnPlayerSpawn, thus no animation will perform if you apply it inside OnPlayerDead callback. You will need to pass a variable to OnPlayerSpawn to determine if a player died and apply the animation from there. Other way around is to check for player's health, if it is below 1.0, then apply the animation on that player or whatever you want to do with him. You can achieve this by utilizing OnPlayerUpdate callback. This would obviously not work if a player is killed instantly, e.g. in an explosion, but may be useful to omit events called by OnPlayerDead callback.
Reply
#4

Quote:
Originally Posted by Konewka
Посмотреть сообщение
OnPlayerDead calls OnPlayerSpawn, thus no animation will perform if you apply it inside OnPlayerDead callback. You will need to pass a variable to OnPlayerSpawn to determine if a player died and apply the animation from there. Other way around is to check for player's health, if it is below 1.0, then apply the animation on that player or whatever you want to do with him. You can achieve this by utilizing OnPlayerUpdate callback. This would obviously not work if a player is killed instantly, e.g. in an explosion, but may be useful to omit events called by OnPlayerDead callback.
Got an headache, could you make the code for me? I'm a bit confused
Reply
#5

Quote:
Originally Posted by DemME
Посмотреть сообщение
Got an headache, could you make the code for me? I'm a bit confused
under onplayerupdate
Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
    if (Health < 10.0)
    {
     //animation
}
Reply
#6

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
under onplayerupdate
Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
    if (Health < 10.0)
    {
     //animation
}
Problem is, whenever I do that, the player still vulnerable and people can instantly come and kill him and it makes a bug that heals the player again, anything that can be possible to make the player not damageable whilst in death mode?

edit: I have done something similar to what you gave me, everything is fine but target vulnerable and the animation repeat itself. any way to make the animation do it once then stays like it?
Reply
#7

Quote:
Originally Posted by DemME
Посмотреть сообщение
Problem is, whenever I do that, the player still vulnerable and people can instantly come and kill him and it makes a bug that heals the player again, anything that can be possible to make the player not damageable whilst in death mode?

edit: I have done something similar to what you gave me, everything is fine but target vulnerable and the animation repeat itself. any way to make the animation do it once then stays like it?
ApplyAnimation(playerid,"PED","KO_skid_back",4.1,0 ,1,1,1,0,1);

try this
ApplyAnimation(playerid,"PED","KO_skid_back",4,0,0 ,0, 1,0,1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)