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;
}
TextDrawShowForPlayer(playerid, Text:Textdraw14);
TextDrawDestroy(Textdraw14);
SetTimer("Damage", 2000, true);
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);
You're destroying the textdraw for all.
Just use TextDrawHideForPlayer. |
I said this to someone else just yesterday: vehicle health goes up to 1000. The vehicle catches fire at 250 health.
|
forward Damage(playerid);
public Damage(playerid)
{
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
if(IsPlayerInAnyVehicle(playerid))
{
if(health > 800)
{
TextDrawColor(Textdraw13[playerid], 0xFFFFFFFF);
}
else if(health <= 800 && health > 500)
{
TextDrawColor(Textdraw13[playerid], 0xFFFF00FF);
}
else if(health <= 400)
{
TextDrawColor(Textdraw13[playerid], 0xFF0000FF);
}
}
else {
TextDrawColor(Textdraw13[playerid], 0xD3D3D3FF);
}
return 1;
}
forward Damage(playerid);
public Damage(playerid)
{
new Float:health;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, health);
printf("--- DEBUG: Vehicle Health on \"public Damage\": %f", health);
if(IsPlayerInAnyVehicle(playerid))
{
if(health > 800)
{
TextDrawColor(Textdraw13[playerid], 0xFFFFFFFF);
}
else if(health <= 800 && health > 500)
{
TextDrawColor(Textdraw13[playerid], 0xFFFF00FF);
}
else if(health <= 400)
{
TextDrawColor(Textdraw13[playerid], 0xFF0000FF);
}
}
else {
TextDrawColor(Textdraw13[playerid], 0xD3D3D3FF);
}
return 1;
}
SetTimer("Damage", 2000, true);
SetTimerEx("Damage", 2000, true, "i", playerid);
Oh... lol... it's probably the fact you have a 'playerid' parameter in the damage function, and it hasn't been defined yet...
Instead of: pawn Код:
pawn Код:
|
ONLY SetString updates for players - for any other modification you need to reshow the TD.
|