Posts: 321
Threads: 160
Joined: May 2009
Reputation:
0
I have some colors in database which are stored as a string. Example: 0xB360FD33. I want to use it in gang zones. I have tryed to use HexToInt function, but it won't work.
GangZoneShowForAll(s3Zone_g_GangZones, color_from_mysql);
Posts: 801
Threads: 30
Joined: Mar 2013
Reputation:
0
They should be saved in a hex then loaded from as a hex.
Posts: 94
Threads: 5
Joined: Oct 2013
Reputation:
0
Can you show us the error?
Posts: 2,593
Threads: 34
Joined: Dec 2007
use sscanf for that
mysqlfetchrow or get field
new zone_color;
sscanf(colorStr,"x",zone_color);
GangZoneShowForAll(s3Zone_g_GangZones, zone_color);
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Save the colors as integers to begin with. Don't try to handle them as strings, because they're not. In your database, they will appear like -16777046 for red, but that's okay. It's just a different way of writing. For this same reason, you can put -1 as a color for client messages. This translates to 0xFFFFFFFF, i.e. pure white.