04.02.2013, 05:48
Textdraw Name: DMG (Damage) assigned to Textdraw14
Description: When the vehicle has a health of more than 75, then the textdraw color will be WHITE(0xFFFFFFFF), when it's Less or equal to 75 but more than 50 the textdraw will be YELLOW, and if 50 and below it'll be red
With that said I came up with this:
Got this on the OnPlayerSpawn callback
And on the OnPlayerDisconnect callback
The timer to update the TD: (I'm not using this on OnPlayerUpdate, but it's on the OnPlayerConnect callback)
The problem is, it does not update. Even though the vehicle's already smoking.
EDIT:
The Textdraw itself
Description: When the vehicle has a health of more than 75, then the textdraw color will be WHITE(0xFFFFFFFF), when it's Less or equal to 75 but more than 50 the textdraw will be YELLOW, and if 50 and below it'll be red
With that said I came up with this:
pawn Код:
forward Damage(playerid);
public Damage(playerid)
{
new Float:health;
new veh;
new dmgstr[10];
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
if(IsPlayerInAnyVehicle(playerid))
{
if(health > 75)
{
format(dmgstr, 10, "DMG");
TextDrawSetString(Textdraw14,dmgstr);
TextDrawColor(Textdraw14, 0xFFFFFFFF);
}
else if(health <= 75 && health > 50)
{
format(dmgstr, 10, "DMG");
TextDrawSetString(Textdraw14, dmgstr);
TextDrawColor(Textdraw14, 0xFFFF00FF);
}
else if(health <= 50)
{
format(dmgstr, 10, "DMG");
TextDrawSetString(Textdraw14, dmgstr);
TextDrawColor(Textdraw14, 0xFF0000FF);
}
}
else {
TextDrawSetString(Textdraw14, "DMG");
TextDrawColor(Textdraw14, 0xD3D3D3FF);
}
return 1;
}
pawn Код:
TextDrawShowForPlayer(playerid, Text:Textdraw14);
pawn Код:
TextDrawDestroy(Textdraw14);
pawn Код:
SetTimer("Damage", 2000, true);
The problem is, it does not update. Even though the vehicle's already smoking.
EDIT:
The Textdraw itself
pawn Код:
Textdraw14 = TextDrawCreate(617.510925, 259.583068, " ");
TextDrawLetterSize(Textdraw14, 0.155300, 0.911665);
TextDrawAlignment(Textdraw14, 1);
TextDrawSetShadow(Textdraw14, 0);
TextDrawSetOutline(Textdraw14, 1);
TextDrawBackgroundColor(Textdraw14, 51);
TextDrawFont(Textdraw14, 1);
TextDrawSetProportional(Textdraw14, 1);