Code
stock HealthToColor(Float:Health)
{
new Color;
if(Health <= 100 && Health >= 50)Color = ( (floatround(255 - (Health * 5.1))) << 24 | 255 << 16 | 0 << 8 | 255 << 0);
if(Health <= 50 && Health >= 0)Color = (255 << 24 | (floatround(Health * 5.1)) << 16 | 0 << 8 | 255 << 0);
return Color;
}
Автор: Ym[0]n.
Пример использования:
Code
public OnPlayerUpdate(playerid)
{
new Float:Health,string[12];
GetPlayerHealth(playerid,Health);
format(string,sizeof(string),"%.f HP",Health);
SetPlayerChatBubble(playerid,string,HealthToColor(Health),20.0,1500);
return true;
}