#define red 1
#define green 2
#define yellow 3
#define purple 4
#define blue 5
#define orange 6
new ColorTag[][] =
{
{red, 0xFF0000},
{green, 0x00FF00},
{yellow, 0xFFFF00},
{purple, 0xBB00FF},
{blue, 0x0000FF},
{orange, 0xFFAA00}
};
PTextDrawColor(playerid, id, color)
{
new idtag;
for(new i; i < sizeof(ColorTag); i++)
{
if(color == ColorTag[i][0])
{
infoT[playerid][id][Color] = ColorTag[i][0];
//PlayerTextDrawColor(playerid, Textdraw[playerid][id], ColorTag[i][1]);
idtag = ColorTag[i][1];
printf("______________%i, %x", ColorTag[i][0], ColorTag[i][1]); //It shows perfectly the hex color, but it doesn't change color
}
}
return PlayerTextDrawColor(playerid, Textdraw[playerid][id], idtag);
}
PTextDrawColor(playerid, id, color)
{
new idtag;
for(new i; i < sizeof(ColorTag); i++)
{
if(color == ColorTag[i][0])
{
infoT[playerid][id][Color] = ColorTag[i][0];
//PlayerTextDrawColor(playerid, Textdraw[playerid][id], ColorTag[i][1]);
idtag = ColorTag[i][1];
printf("______________%i, %x", ColorTag[i][0], ColorTag[i][1]); //It shows perfectly the hex color, but it doesn't change color
PlayerTextDrawColor(playerid, Textdraw[playerid][id], idtag);
}
}
return 1;
}
PHP код:
|
You might want to also add break; into the loop, it doesn't have to continue after the color was found.
Furthermore, your colors miss an Alpha value. Hex format for colors is RRGGBBAA. You can also just remove the idtag variable (and every line it is used) and uncomment PlayerTextDrawColor(...), then it'll work as expected. |
I already tried and didn't work.
It works, I didn't know it was necessary to use transparency. Thanks for the suggestion about the break... I didn't thought about that. If I remove idtag it won't work, as I need to return something ![]() |