HexColor, converting
#1

I've done some research and I've seen several answers but I'm still not sure on how to create a good functional /setcolor [ID] [Hex] cmd, it's about the HexCode.
I've seen things with RGB, I've seen things with 255, and so on... you can mention them all, but after all I'm hoping for some help. I've got no code til so far, I hope that's not an issue.
Reply
#2

Can you tell me example for Hex color ??
Like if u want to set my color then /setcolor 0 (??)
Reply
#3

Ofcourse I can give you an example.
PHP код:
"Usage: /setcolor 0 FF00DD" 
Like that.
Reply
#4

use sscanf.
Reply
#5

Quote:
Originally Posted by oMa37
Посмотреть сообщение
use sscanf.
Lol, I know, but that wasn't my question... My question was how I'm supposed to script that when I do: "FF00DD" the player's colour becomes that colour.
Reply
#6

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Lol, I know, but that wasn't my question... My question was how I'm supposed to script that when I do: "FF00DD" the player's colour becomes that colour.
Literally the same answer.

pawn Код:
new id, color;
sscanf(params, "ux", id, color);
Reply
#7

I've tried it, but it's being strange.
Whenever I do, /setcolor 0 FF00DD (Which is supposed to be Pink) the player's colour is being set as green?
Any idea?
Reply
#8

PHP код:
new idcolor;
sscanf(params"ux"idcolor);
SetPlayerColor(id,(color << 8) | 0xFF); //0xFF is alpha 
Reply
#9

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Literally the same answer.

pawn Код:
new id, color;
sscanf(params, "ux", id, color);
Код:
new id, color;
sscanf(params, "ux", id, color);
SetPlayerColor(id,color);
Check SetPlayerColor to learn about it.
Reply
#10

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
new idcolor;
sscanf(params"ux"idcolor);
SetPlayerColor(id,(color << 8) | 0xFF); //0xFF is alpha 
I still don't understand how << (or >>) works.
Код:
main()
{
	new a = 3;
	printf("%b", a << 1);
	printf("%b", a << 0b1);
	printf("%b & %b", 3, 4);
}
Код:
[02:55:38] 110
[02:55:38] 110
[02:55:38] 11 & 100
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)