int to hex?
#1

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

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

%x Inserts a number in hexadecimal notation.
Reply
#3

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
Reply
#4

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
Reply
#5

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

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.
Reply
#7

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
Reply
#8

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

search...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)