#3

I think the lowest health you can have is 0.0.
If you mean 5.0 rather than -5 then you should first create a global timer which loops through all the players and checks their health. You also need to have a variable for all players to check if the animation already started.
That variable needs to be set to false when a player connects.

PHP код:
new bool:AnimationBegan[MAX_PLAYERS];
public 
OnGameModeInit(){
    
SetTimer("globalTimer",1000,true);
}
public 
OnPlayerConnected(playerid){
    
AnimationBegan[playerid] = false;
}
forward animationDeathTimer(playerid);
public 
animationDeathTimer(playerid){
    
//clear animations
    
ClearAnimations(playerid);
    
//and put player's health to 0
    
SetPlayerHealth(playerid,0.0);
    
//Also clear AnimationBegan variable
    
AnimationBegan[playerid] = false;
    return 
1;
}
forward globalTimer();
public 
globalTimer(){
    for(new 
0;i<MAX_PLAYERS;i++){
    
        if(!
IsPlayerConnected(i))continue;
        
        new 
Float:cHealth;
        
GetPlayerHealth(i,cHealth);
        
        if(
AnimationBegan[i] == false && cHealth <= 5.0){
            
AnimationBegan[i] = true;
            
//I guess thats the proper animation:
            
ApplyAnimation(i"CRACK""crckdeth2"4.010000);
            
//and set the timer to stop the animation
            
SetTimerEx("animationDeathTimer",5*1000,false);
        }
    }
    return 
1;

Reply


Messages In This Thread
Help - by MarkNelson - 31.12.2016, 12:36
Re: Help - by RyderX - 31.12.2016, 12:58
Re: Help - by SoLetsGO - 31.12.2016, 12:58

Forum Jump:


Users browsing this thread: 1 Guest(s)