08.02.2018, 15:14
you must use "else" functions too, or just swap the code from lower-to-upper.
solution 1:
solution 2:
choose one of them, both will work (1st is better)
solution 1:
PHP код:
if(phealth >= 100)
{
SetPlayerColor(playerid, COLOR_GREEN);
}
else if(phealth > 65)
{
SetPlayerColor(playerid, COLOR_YELLOW);
}
else if(phealth > 50)
{
SetPlayerColor(playerid, COLOR_ORANGE);
}
else if(phealth > 40)
{
SetPlayerColor(playerid, COLOR_RED);
}
PHP код:
if(phealth > 40)
{
SetPlayerColor(playerid, COLOR_RED);
}
if(phealth > 50)
{
SetPlayerColor(playerid, COLOR_ORANGE);
}
if(phealth > 65)
{
SetPlayerColor(playerid, COLOR_YELLOW);
}
if(phealth >= 100)
{
SetPlayerColor(playerid, COLOR_GREEN);
}