SHC//Sniper Posted March 28, 2011 Posted March 28, 2011 Well as you may now there is a function to convert a RGB colorcode to a hex number for the dxDrawText function. But I need to now how to convert the hex NUMBER value back to RGB or to a normal hex value. GetColorFromString doesn't work for the tocolor() value. I'm not experienced at formating string so could you give me a function to convert it? Thanks and greets Sniper
Buffalo Posted March 28, 2011 Posted March 28, 2011 Always search before asking - https://forum.multitheftauto.com/viewtopic.php?f=91&t=31829&p=338020&hilit=rgb+hex#p338020 (fourth post if i understood you correctly)
SHC//Sniper Posted March 28, 2011 Author Posted March 28, 2011 No the problem is that tocolor() returns a decimal color with alpha, not a hexdecimal. That means I need a function called decimaltoRGBA(string) EDIT: Or much more simple, tocolor() reversed!
Moderators Citizen Posted March 28, 2011 Moderators Posted March 28, 2011 I think you only can make a decimalToRGB and not decimalToRGBA: You know that in HEXA, the syntax is #RRGGBB you can use string.sub( "The string", start, end ) Exemple: local something = string.sub("Hello MTA user", 3, 5) -- here [b]something[/b] = "llo" Now you can extract the R then the G the the B Note: after 99, it's 9A, 9B, ... 9F, A0, A1, ... A9, AA, AB ... AF, B0, etc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now