megaman54 Posted June 29, 2012 Share Posted June 29, 2012 I wonder how i can enable them. Currently when i type like #00ff00 TEST in chat, it doesnt show the color and the nametags in game shows the color codes instead of the actual colors. How can i fix this? Link to comment
-ffs-Sniper Posted June 29, 2012 Share Posted June 29, 2012 https://wiki.multitheftauto.com/wiki/OutputChatBox The syntax (server-side) is: bool outputChatBox ( string text [, element visibleTo=getRootElement(), int r=255, int g=255, int b=255, bool colorCoded=false ] ) ColorCoded is false by default. In case you would like to have a color coded chatbox message set this to true. Check your gamemode for an "onPlayerChat" event. @Nametags: Default nametags do not support hexdecimal color codes. Link to comment
megaman54 Posted June 29, 2012 Author Share Posted June 29, 2012 Ok i got the chat fixed now thanks. But if i want the color codes to work in nametags do i have to make a new nametag script? Link to comment
TwiX! Posted June 29, 2012 Share Posted June 29, 2012 Ok i got the chat fixed now thanks. But if i want the color codes to work in nametags do i have to make a new nametag script? function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) if not str then return false end str = " "..str ax= ax - dxGetTextWidth(" ", scale, font) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) ax = ax + w color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) end last = e+1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) end end Link to comment
-ffs-Sniper Posted June 29, 2012 Share Posted June 29, 2012 @TwiX: That is not going to help him much since the positioning and scaling is pretty much impossible for scripting newbies. In addition to that "dxDrawText" already has an argument for colored texts. 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