How to convert int to hex? - 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: How to convert int to hex? (
/showthread.php?tid=316031)
How to convert int to hex? -
Superthijs - 05.02.2012
Hi, I'm making a function in which the player can specify his own color.
I'm using three parameters, red, green and blue (all integers).
But now I want to convert these integers into a hex string, is there any function to do that?
Re: How to convert int to hex? -
[WSF]ThA_Devil - 05.02.2012
well you can just do string way:
the difficult part is only after 9:
10 = A
11 = B
12 = C
13 = D
14 = E
15 = F
i suggest you using dialog inputs for each color and than switch:
pawn Код:
switch(color)
{
case 1: clr1 = "1";
case 2: clr1 = "2";
case 14: clr1 = ''D";
}
and then combine it all
Re: How to convert int to hex? -
Superthijs - 05.02.2012
Thanks!
Re: How to convert int to hex? -
[WSF]ThA_Devil - 05.02.2012
Quote:
Originally Posted by Superthijs
Thanks!
|
well, i am not sure if that will work, but have a try...
Код:
This forum requires that you wait 120 seconds between posts. Please try again in 51 seconds.