Death Animation below a certain health
#1

Howdy! Anyone know how I can make it so if a player has under lets say... 33 hp to have a death animation, and sending them a message that they have been critically injured? I've been trying for a while, although it hasn't been going well for me. Thanks in advance.
Reply
#2

Код:
// Gamemodeinit
SetTimer("CheckInjuries", 1000, true);

forward CheckInjuries();
public CheckInjuries()
{
    for(new p = 0; p < MAX_PLAYERS; p++)
    {
       new Float:health;
       GetPlayerHealth(p, health); 
       if(health < 30.0)
       {
           // Do the text and thing here.
          // Make sure to set a variable for the player so that it won't show the message/animation every second.
       }

    }

}
Reply
#3

Thanks, Can you help me with the variable? That's the problem I had with my other script.
Reply
#4

Do you store your player-variables in an enum? Then it would work like this:

Код:
enum PDATA // EXAMPLE
{
     Float:x,
     Float:y,
     Float:z,
     name[24],
     money,
     isInjured
     
}
pInfo[MAX_PLAYERS][PDATA]; // EXAMPLE
Set pInfo[p][isInjured] = 1; when the player gets injured and check:
if(pInfo[p][isInjured] != 1)
{
// Code here
}
Reply
#5

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)