Question: Hex to Embed
#1

Is there a function out there that turns:

0xFF0000FF

to

"{FF0000}"

?

You know:

new string[100];
SendClientMessage(playerid, -1, (format(string, 100, "%sHello World!", HexToEmbed(0xFF0000FF)), string));

Or something similar.

If you could also include the inverse, that'd be great!
Reply
#2

about the hextoembed i don't know if it exist, the other, i guess it's this what you want.

http://forum.sa-mp.com/showpost.php?...&postcount=149
Reply
#3

No, I have something better.

pawn Код:
#define MaxStringSize 1024

new formatString[MaxStringSize];

#define Format(%0)                  (format(formatString, MaxStringSize, %0), formatString) // Thanks to KoczkaHUN for the idea from sprintf [PHP].

#define SendMessageToPlayer(%0,%1)  SendClientMessage((%0), -1, (Format(%1)))
I want a function that converts HEX to string.

But thanks.
Reply
#4

i really recommend you get low with this string, only if you're working with big ones.
Reply
#5

But those macros aren't the problem nor the solution.

I want a function that converts HEX to string.
Reply
#6

well here you go the link download it and then you can convert Hex to String

http://www.mediafire.com/?67c2gsj98g7hqoc

+rep if that helps
Reply
#7

...

A function... that converts... HEX to string...

=/ A function, a function, THAT CONVERTS, Hex to string, Hex to string, HEX TO FREAKIN STRING.

Sorry for nerd rage, but how hard is it to understand.
Reply
#8

oh sorry here you go you can convert it online

http://www.string-functions.com/hex-string.aspx
Reply
#9

I give up, just nevermind it.
Reply
#10

Same thing you asked for:

pawn Код:
#define HexToEmbed(%0) HexToEmbed_Final(#%0)

stock HexToEmbed_Final(szHex[])
{
    new
        szVal[16];
       
    format(szVal, sizeof(szVal), "{%s}", szHex);
    strdel(szVal, 1, 3);
    strdel(szVal, strlen(szVal) - 3, strlen(szVal) - 1);
    return szVal;
}

// Example: printf("%s", HexToEmbed(0xFFFF00FF));
// Output: {FFFF00}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)