[Tool/Web/Other] GTA:SA Car colours as Hex (0-126)
#1

GTA:SA vehicle colours as hexadecimal values
For use in labels, text messages and textdraws.


I spent some time and converted all GTA:SA colour IDs ranging from 0 to 126 into hexadecimal values in the 0xRRGGBBAA format so they can be used in messages, tabels and textdraws. Paste also includes a function to convert the hex to the SA-MP embedding format ({RRGGBB}) and the RGB colour values (commented out)


Data

Complete pastebin

Raw data:
pawn Код:
new CarColHex[127] = {
0x000000FF,0xF5F5F5FF,0x2A77A1FF,0x840410FF,0x263739FF,0x86446EFF,0xD78E10FF,0x4C75B7FF,
0xBDBEC6FF,0x5E7072FF,0x46597AFF,0x656A79FF,0x5D7E8DFF,0x58595AFF,0xD6DAD6FF,0x9CA1A3FF,
0x335F3FFF,0x730E1AFF,0x7B0A2AFF,0x9F9D94FF,0x3B4E78FF,0x732E3EFF,0x691E3BFF,0x96918CFF,
0x515459FF,0x3F3E45FF,0xA5A9A7FF,0x635C5AFF,0x3D4A68FF,0x979592FF,0x421F21FF,0x5F272BFF,
0x8494ABFF,0x767B7CFF,0x646464FF,0x5A5752FF,0x252527FF,0x2D3A35FF,0x93A396FF,0x6D7A88FF,
0x221918FF,0x6F675FFF,0x7C1C2AFF,0x5F0A15FF,0x193826FF,0x5D1B20FF,0x9D9872FF,0x7A7560FF,
0x989586FF,0xADB0B0FF,0x848988FF,0x304F45FF,0x4D6268FF,0x162248FF,0x272F4BFF,0x7D6256FF,
0x9EA4ABFF,0x9C8D71FF,0x6D1822FF,0x4E6881FF,0x9C9C98FF,0x917347FF,0x661C26FF,0x949D9FFF,
0xA4A7A5FF,0x8E8C46FF,0x341A1EFF,0x6A7A8CFF,0xAAAD8EFF,0xAB988FFF,0x851F2EFF,0x6F8297FF,
0x585853FF,0x9AA790FF,0x601A23FF,0x20202CFF,0xA4A096FF,0xAA9D84FF,0x78222BFF,0x0E316DFF,
0x722A3FFF,0x7B715EFF,0x741D28FF,0x1E2E32FF,0x4D322FFF,0x7C1B44FF,0x2E5B20FF,0x395A83FF,
0x6D2837FF,0xA7A28FFF,0xAFB1B1FF,0x364155FF,0x6D6C6EFF,0x0F6A89FF,0x204B6BFF,0x2B3E57FF,
0x9B9F9DFF,0x6C8495FF,0x4D5D60FF,0xAE9B7FFF,0x406C8FFF,0x1F253BFF,0xAB9276FF,0x134573FF,
0x96816CFF,0x64686AFF,0x105082FF,0xA19983FF,0x385694FF,0x525661FF,0x7F6956FF,0x8C929AFF,
0x596E87FF,0x473532FF,0x44624FFF,0x730A27FF,0x223457FF,0x640D1BFF,0xA3ADC6FF,0x695853FF,
0x9B8B80FF,0x620B1CFF,0x5B5D5EFF,0x624428FF,0x731827FF,0x1B376DFF,0xEC6AAEFF};
How to use

Use is simple. The values are compressed into array to simplify usage.
Example:

pawn Код:
if(!strcmp(cmdtext, "/changecolour", true))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
        ChangeVehicleColor(GetPlayerVehicleID(playerid), 5, 5);
        SendClientMessage(playerid, CarColHex[5], "You car colour has been changed to ID 5");
    }
        return 1;
    }
So, simply use CarColHex[i] to call the array with i standing for the colour ID you have set.


Embedding:

pawn Код:
if(!strcmp(cmdtext, "/changecolour", true))
    {
        if(IsPlayerInAnyVehicle(playerid))
    {
        ChangeVehicleColor(GetPlayerVehicleID(playerid), 5, 5);
        new msg[300];
        format(msg, sizeof(msg), "COLOR CHANGED!%s This is your new colour (ID 5).", HexToEmbed(CarColHex[5]));
        SendClientMessage(playerid, 0xFFFFFFFF, msg);
    }
        return 1;
    }
Use HexToEmbed(); (included in pastebin file) to convert an 0xRRGGBBAA format colour to "{RRGGBB}" format and insert it into the message/tabel/textdraw string using the %s specifier.

Have fun.
Reply
#2

cool, i have been also trying out to make hex but meh i using color picker lol :P
later i tried to make all valid color in array but couldnt find out correct way to make dem hex :d

THanks for this,
will use for awesomeness
Reply
#3

Very useful Drebin, good job.
Reply
#4

I guess y_colors has all kind of colors, even transparent (not for cars of course). I aprreciate the effort
Reply
#5

It's very useful, I will use this
Reply
#6

Very useful. Good for you. Nice work.
Reply
#7

Thank you, this saved me a lot of time. Good job.
(/credits given)
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
I don't know if these were there at the time, but all 256 SA:MP car colours are on the wiki:

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

They have been added afterwards.
Reply
#9

That's perfect. I greatly appreciate it. Whatever it is. Congratulations on your efforts.

#March
Reply
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
I don't know if these were there at the time, but all 256 SA:MP car colours are on the wiki:

https://sampwiki.blast.hk/wiki/Color_ID
To be honest, that list is kind of weird. It's neither ARGB and RGBA. It's seems to AGBR. I don't have a Wiki account, so I can't change it, unfortunately.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)