SA-MP Forums Archive
[Help] 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: [Help] Color (/showthread.php?tid=87286)



[Help] Color - borisblat - 19.07.2009

How can i do the command: /ChangeColor [R] [G] [B] ?

thanks,=]



Re: [Help] Color - Weirdosport - 19.07.2009

You first need to seperate the values the player gives. Then you'll be left with 3 integers. I'm going to call them R G and B. The Alpha channel, will be A. This determines how opaque/transparent the text will be. You need to define this yourself (0-255). Col will be the output, which is the integer value of the colour.

pawn Код:
//top of script
#define A 255

//in the function/command etc
R *= 16777216;
G *= 65536;
B *= 256
Col = R + G + B + A;




Re: [Help] Color - borisblat - 19.07.2009

Edit: Wait, so i do

new R = strval(tmp);
new G = strval(tmp);
new B = strval(tmp);

new Col = R + G + B; ?



Re: [Help] Color - Weirdosport - 19.07.2009

Quote:
Originally Posted by borisblat
and where is the B interger?,
edit: oops, i forgot to put "B" in the question..
The B is there...

Oh but I haven't added the alpha channel bit.. What do you want it to default as, FF or AA?


Re: [Help] Color - borisblat - 19.07.2009

yes sorry, didn't noticed, well look at my edit ..

Edit: Wait, so i do

new R = strval(tmp);
new G = strval(tmp);
new B = strval(tmp);

new Col = R + G + B; ?


Re: [Help] Color - ByFukara - 19.07.2009

Код:
B *= 16;



Re: [Help] Color - borisblat - 19.07.2009

wtf, i don't know so much about c++...
what the *= mean?


Re: [Help] Color - ByFukara - 19.07.2009

for exam.
2 * 16


Re: [Help] Color - Weirdosport - 19.07.2009

Not sure why you're talking about *= 16... And you don't just add the numbers together, you need to times them by powers of 256.

_________________________________________________

A *= 10

is the same as:

A = A * 10

_________________________________________________

You have to do the strval bit or whatever for yourself, but you need to have the numbers you want stored in the variables R G and B, before you do what I just did to them. If in doubt send the code.

_________________________________________________

Note, I just changed the code so that it would work.


Re: [Help] Color - borisblat - 19.07.2009

well, so i do this thing, what ever it is, and then i do

SetPlayerColor(playerid, Col);?