How to save & load hex color on MySQL?
#1

Well the title says it all. I've tried using integer but it's all messed up. I want to know an efficient way of saving and loading it.
Reply
#2

What exactly doesn't work? Can we see your saving and loading code?
Reply
#3

It only saves the digits.
Reply
#4

The what? I don't quite understand.
Reply
#5

Digits is 1 4 6 8 0, ie. numbers.

This guy doesn't know how to save hex values
0xFFFFFF 0xABCDEF etc
Reply
#6

Quote:
Originally Posted by CaHbKo
Посмотреть сообщение
Digits is 1 4 6 8 0, ie. numbers.

This guy doesn't know how to save hex values
0xFFFFFF 0xABCDEF etc
Right.
Reply
#7

well u can try sscanf ! for saving
its like >>

u can try that ^^
u know mysql right?
Reply
#8

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
well u can try sscanf ! for saving
its like >>

u can try that ^^
u know mysql right?
Could you please explain properly?

Edit: Any other way? Because it gets messed up after it got inserted on mysql db.
Reply
#9

Colors are numbers, and numbers can be changed into any notation you'd like.

Suppose you have this: 0x0000FF99, which is a blue color. If you save it as integer in MySQL you would get 65433 as a value for that field, which is the correct decimal value for that hex color. Doing this works:
pawn Код:
SendClientMessage(playerid, 65433, "This message is blue!");
As does this:
pawn Код:
printf("Hex: %08x - Decimal: %d", 65433, 0x0000FF99);
Reply
#10

@Vince - Never knew it! You deserve reputation from me.
@****** - I already got the solution but I will surely look at that thread and learn more about colors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)