SA-MP Forums Archive
Death Animation below a certain health - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Death Animation below a certain health (/showthread.php?tid=579003)



Death Animation below a certain health - Krakuski - 23.06.2015

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.


Re: Death Animation below a certain health - AlonzoTorres - 23.06.2015

Код:
// 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.
       }

    }

}



Re: Death Animation below a certain health - Krakuski - 23.06.2015

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


Re: Death Animation below a certain health - AlonzoTorres - 23.06.2015

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
}


Re: Death Animation below a certain health - Krakuski - 23.06.2015

Thanks!