Setting a textdraws Color
#1

I've been having this error for a while now, and its getting annoying.

Код:
error 035: argument type mismatch (argument 2)
pawn Код:
new color[16];
    if(0 < fSpeed <= 30) color = "0x04B404FF";
    else if(30 < fSpeed <= 50) color = "0x5FB404FF";
    else if(50 < fSpeed <= 70) color = "0xAEB404FF";
    else if(70 < fSpeed <= 90) color = "0xB45F04FF";
    else if(90 < fSpeed <= 110) color = "0xDF7401FF";
    else if(110 < fSpeed < 1000) color = "0xDF0101FF";


    TextDrawColor(SPEEDOMETER[playerid], color);
Reply
#2

Colors are not strings.
Reply
#3

Indeed, their hexadecimals. Use the %x operator.
Reply
#4

Quote:
Originally Posted by admantis
Посмотреть сообщение
Indeed, their hexadecimals. Use the %x operator.
I'd love to, but nowhere am I using %s.
Reply
#5

I would just start using the hexadecimals.
Reply
#6

He meant use 0x in front.
pawn Код:
new color = 0xFF0000AA; //red
TextDrawColor(SPEEDOMETER[playerid], color);
Reply
#7

You can store colors in ints.
pawn Код:
new color;
color = 0x04B404FF;
EDIT: Too slow.
Reply
#8

I want the "color" of the textdraw to depend on the fSpeed.
Reply
#9

Then do it like we told you.

pawn Код:
new color;
    if(0 < fSpeed <= 30) color = 0x04B404FF;
    else if(30 < fSpeed <= 50) color = 0x5FB404FF;
    else if(50 < fSpeed <= 70) color = 0xAEB404FF;
    else if(70 < fSpeed <= 90) color = 0xB45F04FF;
    else if(90 < fSpeed <= 110) color = 0xDF7401FF;
    else if(110 < fSpeed < 1000) color = 0xDF0101FF;

    TextDrawColor(SPEEDOMETER[playerid], color);
Reply
#10

Alright, thanks everybody. it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)