function hex2rgb (hex)
local hex = hex:gsub("#","")
if hex:len() == 3 then
return (tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255
else
return tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255
end
end
-- exemple usage: (NOT TESTED the command) but the function works fine
addEventHandler("onPlayerCommand",root,
function(command, player)
if (command == "convert") then
outputConsole("Result: " .. hex2rgb("#ffffff"),player)
end
end)