Change TextDraw color -
cnoopers - 19.03.2015
Always that first, why is it not changing?
Код:
new vehicleid = GetPlayerVehicleID(playerid);
new Float:vhealth[MAX_VEHICLES];
GetVehicleHealth(vehicleid, vhealth[vehicleid]);
if(vhealth[vehicleid] >= 900.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x00FF00FF);
}else if(vhealth[vehicleid] <= 800.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x84FF00FF);
}else if(vhealth[vehicleid] <= 700.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xAEFF00FF);
}else if(vhealth[vehicleid] <= 600.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xD5FF00FF);
}else if(vhealth[vehicleid] <= 500.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFFFF00FF);
}else if(vhealth[vehicleid] <= 400.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFFC400FF);
}else if(vhealth[vehicleid] <= 300.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFF8400FF);
}else if(vhealth[vehicleid] <= 200.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFF3C00FF);
}
Re: Change TextDraw color -
fuckingcruse - 19.03.2015
Explain your problem , and we can help you
Re: Change TextDraw color -
cnoopers - 19.03.2015
Color of textdraw is not changing by getting health of vehicle. Is always default -
0x00FF00FF.
Re: Change TextDraw color -
Golf - 19.03.2015
you must hide show the textdraw agains
PHP код:
if(vhealth[vehicleid] >= 900.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid])
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x00FF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid])
}
Re: Change TextDraw color -
cnoopers - 19.03.2015
Anyway, still same problem.
Код:
new vehicleid = GetPlayerVehicleID(playerid);
new Float:vhealth[MAX_VEHICLES];
GetVehicleHealth(vehicleid, vhealth[vehicleid]);
if(vhealth[vehicleid] >= 900.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x00FF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 800.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x84FF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 700.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xAEFF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 600.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xD5FF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 500.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFFFF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 400.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFFC400FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 300.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFF8400FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}else if(vhealth[vehicleid] <= 200.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid]);
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFF3C00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);
}
Re: Change TextDraw color -
Golf - 19.03.2015
write printf
PHP код:
new vehicleid = GetPlayerVehicleID(playerid);
new Float:vhealth[MAX_VEHICLES];
GetVehicleHealth(vehicleid, vhealth[vehicleid]);
if(vhealth[vehicleid] >= 900.0)
{
PlayerTextDrawHide(playerid, TD_VPARAMS[1][playerid])
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x00FF00FF);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid])
printf("done test 1");
}else if(vhealth[vehicleid] <= 800.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x84FF00FF);
}else if(vhealth[vehicleid] <= 700.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xAEFF00FF);
}else if(vhealth[vehicleid] <= 600.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xD5FF00FF);
}else if(vhealth[vehicleid] <= 500.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFFFF00FF);
}else if(vhealth[vehicleid] <= 400.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFFC400FF);
}else if(vhealth[vehicleid] <= 300.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFF8400FF);
}else if(vhealth[vehicleid] <= 200.0)
{
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0xFF3C00FF);
printf("done test 2");
}
Re: Change TextDraw color -
Jefff - 19.03.2015
if vhealth is <= 800 code stops at PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], 0x84FF00FF);
pawn Код:
new Float:vhealth,vehicleid,idx;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, vhealth);
static const col[] = {0x00FF00FF, 0x84FF00FF, 0xAEFF00FF, 0xD5FF00FF, 0xFFFF00FF, 0xFFC400FF, 0xFF8400FF, 0xFF3C00FF};
if(vhealth >= 900.0) idx = 0;
else if(700.0 <= vhealth <= 800.0) idx = 1;
else if(600.0 <= vhealth <= 700.0) idx = 2;
else if(500.0 <= vhealth <= 600.0) idx = 3;
else if(400.0 <= vhealth <= 500.0) idx = 4;
else if(300.0 <= vhealth <= 400.0) idx = 5;
else if(200.0 <= vhealth <= 300.0) idx = 6;
else idx = 7;
PlayerTextDrawColor(playerid, TD_VPARAMS[1][playerid], col[idx]);
PlayerTextDrawShow(playerid, TD_VPARAMS[1][playerid]);