UnG//Macaus Posted October 10, 2014 Share Posted October 10, 2014 How can I add color codes in my text? I tried this but does not work function dxDrawBorderedText(text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded) text_ = text:gsub ( "#%x%x%x%x%x%x", "" ) dxDrawText(text_, x - 0.6, y - 0.6, w - 0.6, h - 0.6, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x + 0.6, y - 0.6, w + 0.6, h - 0.6, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x - 0.6, y + 0.6, w - 0.6, h + 0.6, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x + 0.6, y + 0.6, w + 0.6, h + 0.6, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x - 0.6, y, w - 0.6, h, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x + 0.6, y, w + 0.6, h, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x, y - 0.6, w, h - 0.6, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text_, x, y + 0.6, w, h + 0.6, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, false, true) dxDrawText(text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded) end dxDrawBorderedText(Text, x*150, y*540, x*1400, y*385, tocolor(255, 255, 255, 255), x*2.4, x*2.4, "clear", "center", "center", false, false, true, true) Link to comment
DNL291 Posted October 10, 2014 Share Posted October 10, 2014 function dxDrawBorderedText(text, left, top, right, bottom, color, scale, outlinesize, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded) outlinesize = math.min(scale, outlinesize) if outlinesize > 0 then for offsetX=-outlinesize,outlinesize,outlinesize do for offsetY=-outlinesize,outlinesize,outlinesize do if not (offsetX == 0 and offsetY == 0) then dxDrawText(text:gsub("#%x%x%x%x%x%x",""), left+offsetX, top+offsetY, right+offsetX, bottom+offsetY, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI) end end end end dxDrawText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded) end Try it. dxDrawBorderedText(Text, x*150, y*540, x*1400, y*385, tocolor(255, 255, 255, 255), 1, 1, "clear", "center", "center", false, false, true, true) Just edit the arguments: scale and the size of the border, if it's nedded. Link to comment
UnG//Macaus Posted October 10, 2014 Author Share Posted October 10, 2014 working, thank you very much Link to comment
UnG//Macaus Posted October 12, 2014 Author Share Posted October 12, 2014 , Now when I start the resource I got this error: WARNING: Script 'script.lua' is not encoded in UTF-8. Loading as ANSI... can someone help me? Link to comment
DNL291 Posted October 12, 2014 Share Posted October 12, 2014 Change encoding to: UTF-8 without BOM. Link to comment
UnG//Macaus Posted October 12, 2014 Author Share Posted October 12, 2014 Thank you again Link to comment
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