SA-MP Forums Archive
saving colors into mysql (using sscanf) - 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: saving colors into mysql (using sscanf) (/showthread.php?tid=640187)



solved - verlaj - 29.08.2017

removed


Re: saving colors into mysql (using sscanf) - 10MIN - 29.08.2017

My face now is like: "What the hell..."

Where you "query" the database?

The code you gived is more than useless...


Re: saving colors into mysql (using sscanf) - verlaj - 29.08.2017

i am talking about the code, the query works fine. (when i try it other way around i get this "581034239")

Edit: and nothing is useless 10MIN, everything here has a meaning.


Re: saving colors into mysql (using sscanf) - Vince - 29.08.2017

Those snippets you posted make no sense. It is supposed to look like 581034239 because that is an integer value. The fact that it doesn't look like what you're used to is because integer values are stored in base 10 rather than base 16. If you execute
PHP код:
SELECT HEX(581034239); 
You'll get
Код:
22A1E0FF
Note that you should not use the HEX function in a normal select, this is just for demonstration purposes.


Re: saving colors into mysql (using sscanf) - 10MIN - 29.08.2017

The query is not working (you said that it inputs 0 in mysql table)... Also you don't need sscanf... Also read What is the difference in representing colours this way #ffffff and 0xffffff?

Also the query should be like:
format(query,sizeof(query),"INSERT INTO colors SET group_color = %d", groupinfo[gruid][color])
E:Vince was faster than me


Re: saving colors into mysql (using sscanf) - verlaj - 29.08.2017

thanks vince, and thanks to you too for replying 10min.

Edit: should've used inttohex -_-