09.02.2018, 12:20
So it works but sometimes the red color won't apply on the player's name, all of the colors work till orange
Код:
public OnPlayerUpdate(playerid)
{
// Health TD.
new InfoString[110];
if(IsPlayerConnected(playerid))
{
if(IsPlayerNPC(playerid)) return 0;
new Float:healthplayer;
GetPlayerHealth(playerid, healthplayer);
format(InfoString, sizeof(InfoString), "hp: %.0f", healthplayer);
TextDrawSetString(HPP[playerid], InfoString);
format(InfoString, sizeof(InfoString), "%d", pInfo[playerid][Points]);
TextDrawSetString(CASH4[playerid], InfoString);
if(healthplayer >= 100)
{
SetPlayerColor(playerid, COLOR_LIME);
}
else if(healthplayer > 65)
{
SetPlayerColor(playerid, COLOR_YELLOW);
}
else if(healthplayer > 50)
{
SetPlayerColor(playerid, COLOR_ORANGE);
}
else if(healthplayer > 40)
{
SetPlayerColor(playerid, COLOR_RED);
}
}
}


