SA-MP Forums Archive
Setting a textdraws Color - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Setting a textdraws Color (/showthread.php?tid=217038)



Setting a textdraws Color - Antonio [G-RP] - 26.01.2011

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);



Re: Setting a textdraws Color - Vince - 26.01.2011

Colors are not strings.


Re: Setting a textdraws Color - admantis - 26.01.2011

Indeed, their hexadecimals. Use the %x operator.


Re: Setting a textdraws Color - Antonio [G-RP] - 27.01.2011

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


Re: Setting a textdraws Color - A.Bowers - 27.01.2011

I would just start using the hexadecimals.


Re: Setting a textdraws Color - Krx17 - 27.01.2011

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



Re: Setting a textdraws Color - iggy1 - 27.01.2011

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


Re: Setting a textdraws Color - Antonio [G-RP] - 27.01.2011

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


Re: Setting a textdraws Color - Krx17 - 27.01.2011

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);



Re: Setting a textdraws Color - Antonio [G-RP] - 27.01.2011

Alright, thanks everybody. it works