AlvarO Posted June 23, 2016 Share Posted June 23, 2016 Hey guys I was doing a radio script and when I tried to get the radio song and the guy who is streaming used dxGetTextWidth for make it sizable with a rectangle, but I dont know how to make it function drawing() if sound then if (working) then local ls,rs = getSoundLevelData(sound); if (ls ~= false) then if moveOn == true then local meta = getSoundMetaTags(sound); local title = meta.title or "Unknown" local name = meta.stream_name or "Unknown" local longitud = dxGetTextWidth ( title, 1.25, myFont, true ) local longitud2 = dxGetTextWidth (" || Played by: "..name, 1.25, myFont, true ) --Marco dxDrawRectangle(x*1630, y*70, -longitud-longitud2-15, y*30, tocolor(255, 136, 0, 255), false) --Soundwave dxDrawRectangle(x*1625, y*100, x*5, (x*(-30))*(ls/32768), tocolor(0, 0, 0, 255), true) if title then dxDrawText(title.." || Played by: "..name, x*longitud+longitud2, y*(-153), x*852, y*326, tocolor(0, 0, 0, 255), 1.25, myFont, "center", "center", true, true, true, true, true) else title = "Song can't be found sorry." end end end end end end addEventHandler("onClientRender", root, drawing) Link to comment
Overkillz Posted June 23, 2016 Share Posted June 23, 2016 (edited) function drawing() if sound then if (working) then local ls,rs = getSoundLevelData(sound); if (ls ~= false) then if moveOn == true then local meta = getSoundMetaTags(sound); local title = meta.title or "Unknown" local name = meta.stream_name or "Unknown" local longitud = dxGetTextWidth ( title, 1.25, myFont, true ) local longitud2 = dxGetTextWidth (" || Played by: "..name, 1.25, myFont, true ) --Marco dxDrawRectangle(x*1630, y*70, longitud+longitud2, y*30, tocolor(255, 136, 0, 255), false) --Soundwave dxDrawRectangle(x*1625, y*100, x*5, (x*(-30))*(ls/32768), tocolor(0, 0, 0, 255), true) if title then dxDrawText(title.." || Played by: "..name, x*1630, y*70, x*1630+(longitud+longitud2), y*70+(y*30), tocolor(0, 0, 0, 255), 1.25, myFont, "center", "center", true, true, true, true, true) else title = "Song can't be found sorry." end end end end end end addEventHandler("onClientRender", root, drawing) Edited June 24, 2016 by Guest 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