10.06.2010, 20:19
Hey,
So i made this thing that shows you how much health you have over the health bar.
Part of the code:
Well the problem is that for example if i have 100% left,it shows 100,but if i have 10,20,30,40-99
it shows: 10. or 20. etc.
Well It's ugly,anyway to fix it guys?
Thanks in advance.
EDIT:
Would this work? :
So i made this thing that shows you how much health you have over the health bar.
Part of the code:
pawn Код:
forward Fuck123(playerid);
public Fuck123(playerid)
{
new str[4],Float:h;
GetPlayerHealth(playerid,h);
format(str,sizeof(str),"%f",h);
TextDrawSetString(PlayerInfo[playerid][pInfoTxt],str);
TextDrawShowForPlayer(playerid,PlayerInfo[playerid][pInfoTxt]);
}
it shows: 10. or 20. etc.
Well It's ugly,anyway to fix it guys?
Thanks in advance.
EDIT:
Would this work? :
pawn Код:
forward Fuck123(playerid);
public Fuck123(playerid)
{
new Float:h;
if(GetPlayerHealth(playerid,h) >= 100)
{
new str[4];
GetPlayerHealth(playerid,h);
format(str,sizeof(str),"%f",h);
TextDrawSetString(PlayerInfo[playerid][pInfoTxt],str);
}
else if(GetPlayerHealth(playerid,h) < 100 || h > 10)
{
new str2[3];
GetPlayerHealth(playerid,h);
format(str2,sizeof(str2),"%f",h);
TextDrawSetString(PlayerInfo[playerid][pInfoTxt],str2);
}
else if(GetPlayerHealth(playerid,h) < 10)
{
new str3[2];
GetPlayerHealth(playerid,h);
format(str3,sizeof(str3),"%f",h);
TextDrawSetString(PlayerInfo[playerid][pInfoTxt],str3);
}
}