SA-MP Forums Archive
color from mysql - 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)
+--- Thread: color from mysql (/showthread.php?tid=472292)



color from mysql - ajwar - 27.10.2013

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);


Re: color from mysql - Isolated - 27.10.2013

They should be saved in a hex then loaded from as a hex.


Re: color from mysql - ajwar - 27.10.2013

any example?


Re: color from mysql - Hamam - 27.10.2013

Can you show us the error?


Re: color from mysql - ajwar - 27.10.2013

i just can't load the color from my db corectly and then use it


Re: color from mysql - Jefff - 27.10.2013

use sscanf for that

mysqlfetchrow or get field

new zone_color;
sscanf(colorStr,"x",zone_color);
GangZoneShowForAll(s3Zone_g_GangZones, zone_color);


Re: color from mysql - Vince - 27.10.2013

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.