[Help] Color
#1

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

thanks,=]
Reply
#2

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;

Reply
#3

Edit: Wait, so i do

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

new Col = R + G + B; ?
Reply
#4

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?
Reply
#5

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; ?
Reply
#6

Код:
B *= 16;
Reply
#7

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

for exam.
2 * 16
Reply
#9

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.
Reply
#10

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

SetPlayerColor(playerid, Col);?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)