SA-MP Forums Archive
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: int to hex? (/showthread.php?tid=433893)



int to hex? - newbienoob - 30.04.2013

How to convert an integer to hex? I already searched. But none of them help.


Re: int to hex? - Pottus - 30.04.2013

https://sampwiki.blast.hk/wiki/Format

%x Inserts a number in hexadecimal notation.


Re: int to hex? - Isolated - 30.04.2013

Ummmmm.. This isn't the correct answer but this may help

http://forum.sa-mp.com/showpost.php?...&postcount=116

EDIT: I may have got the wrong idea :P


Re: int to hex? - newbienoob - 30.04.2013

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Format

%x Inserts a number in hexadecimal notation.
That's not what I wanted. I want this number 1677786880 to be in hexadecimal like;
1677786880 would be 0x6400FF00/FF


Re: int to hex? - MP2 - 30.04.2013

[uL]Pottus told you the answer. Use the %x specifier in format().


Re: int to hex? - Pottus - 30.04.2013

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
That's not what I wanted. I want this number 1677786880 to be in hexadecimal like;
1677786880 would be 0x6400FF00/FF
If that is not what you want then I don't think you know what you want or what you want doesn't exist in pawn/not practical.


Re: int to hex? - newbienoob - 30.04.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Integers and hex numbers are THE SAME THING. They are just different ways of writing a number for humans, but once your code is compiled they're all the same.

Read this:

https://sampforum.blast.hk/showthread.php?tid=200876
Ok so color is an integer. But why my server crashes everytime I save player's color as integer?
pawn Код:
INI_WriteInt(file,"Color",GetPlayerColor(playerid));
Also, I have this
r = 100
g = 0
b = 255
(r * 16777216) + (g * 65536) + (b*256)

So it would be
1677786880 and I convert it to hex 6400FF00
Why alpha is 00? How can I change it to AA or FF or 99


Re: int to hex? - mastermax7777 - 30.04.2013

http://www.openstrike.co.uk/cgi-bin/decimalhex.cgi

search...