Textdraw problem
#2

Код:
new Text:Text[MAX_PLAYERS];
new Float:VehicleHealth;
new string[128];

public OnPlayerUpdate(playerid)
{
	if(IsPlayerInAnyVehicle(playerid) == 1)
	{
		new VehicleID = GetPlayerVehicleID(playerid);
		GetVehicleHealth(VehicleID, VehicleHealth);
        VehicleHealth = floatround(VehicleHealth / 10, floatround_round);
		format(string,sizeof(string), "%0.0f%%", VehicleHealth);
		TextDrawDestroy(Text[playerid]);
		Text[playerid] = TextDrawCreate(5, 433, string);
		TextDrawSetShadow(Text[playerid], 0);
		TextDrawUseBox(Text[playerid], 1);
		TextDrawBoxColor(Text[playerid], 0x202020FF);
		TextDrawTextSize(Text[playerid], 48, 0);
  		if(VehicleHealth <= 100) TextDrawColor(Text[playerid],0x00FF00FF);
		if(VehicleHealth < 90) TextDrawColor(Text[playerid],0x40FF00FF);
  		if(VehicleHealth < 80) TextDrawColor(Text[playerid],0x80FF00FF);
  		if(VehicleHealth < 70) TextDrawColor(Text[playerid],0xC0FF00FF);
 		if(VehicleHealth < 60) TextDrawColor(Text[playerid],0xFFFF00FF);
 		if(VehicleHealth < 50) TextDrawColor(Text[playerid],0xFFC000FF);
		if(VehicleHealth < 40) TextDrawColor(Text[playerid],0xFF8000FF);
		if(VehicleHealth < 30) TextDrawColor(Text[playerid],0xFF4000FF);
		if(VehicleHealth < 25) TextDrawColor(Text[playerid],0xFF0000FF);
		TextDrawShowForPlayer(playerid, Text[playerid]);
	}
	if(IsPlayerInAnyVehicle(playerid) == 0) TextDrawDestroy(Text[playerid]);
	return 1;
}
Try this.
Reply


Messages In This Thread
Textdraw problem - by Superthijs - 28.01.2012, 09:41
Re : Textdraw problem - by Gagi_Corleone - 28.01.2012, 10:07
Re: Textdraw problem - by Superthijs - 28.01.2012, 10:13
AW: Textdraw problem - by Nero_3D - 28.01.2012, 10:45

Forum Jump:


Users browsing this thread: 1 Guest(s)