Sex* Posted February 5, 2013 Share Posted February 5, 2013 So i thought i start to make new toptimes from beginning today because the last one was was lagging the server with errors and was compiled because it was downloaded from internet. I made everything ready but then i saw that the color codes didnt work . How to make that it would be possible to make color codes to work? Link to comment
Fury Posted February 5, 2013 Share Posted February 5, 2013 So i thought i start to make new toptimes from beginning today because the last one was was lagging the server with errors and was compiled because it was downloaded from internet. I made everything ready but then i saw that the color codes didnt work . How to make that it would be possible to make color codes to work? are you using dxCreateText or GUICreateLabel? Link to comment
gokalpfirat Posted February 5, 2013 Share Posted February 5, 2013 text = guiCreateLabel(0.5,0.5,0.5,0.5,"Test",true) guiLabelSetColor(text,255,0,0) GuiLabelSetColor Link to comment
Sex* Posted February 5, 2013 Author Share Posted February 5, 2013 FACEPALM, this is how it looks right now: As you guys see, NO COLORS(only colorcodes). But i want it to be colored, so how to make it? Link to comment
gokalpfirat Posted February 5, 2013 Share Posted February 5, 2013 local r, g, b = getPlayerNametagColor ( player ) You can use this. Link to comment
Sex* Posted February 5, 2013 Author Share Posted February 5, 2013 And where do i add it? Link to comment
Fury Posted February 5, 2013 Share Posted February 5, 2013 you have to use https://wiki.multitheftauto.com/wiki/DxDrawText for colored texts. Link to comment
Guest Guest4401 Posted February 6, 2013 Share Posted February 6, 2013 Use guiCreateColorLabel instead of guiCreateLabel This function is made by someone on the forum, I don't know who. function guiCreateColorLabel( ax, ay, bx, by,str, bool, parent ) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find( pat, 1 ) local last = 1 local r,g,b while s do if cap == "" and col then r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth( cap ) avc321 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end guiLabelSetColor( avc321,r,g,b ) ax = ax + w r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then local cap = str:sub( last ) local w = dxGetTextWidth( cap ) local avc123 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) guiLabelSetColor( avc123,r or 255,g or 255,b or 255 ) return avc123 end end Link to comment
Sex* Posted February 6, 2013 Author Share Posted February 6, 2013 What the hell?...and where do i put it in client? Link to comment
DNL291 Posted February 6, 2013 Share Posted February 6, 2013 What the hell?...and where do i put it in client? Yes, it's clientside. But the function have some bugs with color codes. Link to comment
Sex* Posted February 7, 2013 Author Share Posted February 7, 2013 What the hell?...and where do i put it in client? Yes, it's clientside. But the function have some bugs with color codes. Yes, i know that the coloring function is in the clientside but i cant find a place where should i put it... Link to comment
Guest Guest4401 Posted February 7, 2013 Share Posted February 7, 2013 Put it in the very first line, and replace guiCreateLabel with guiCreateColorLabel everywhere except in the function itself. Link to comment
Sex* Posted February 7, 2013 Author Share Posted February 7, 2013 Now my MTA crashes then i start the resource...i can only turn off MTA with taskmanager... 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