Dzsozi (h03) Posted December 16, 2014 Share Posted December 16, 2014 Hello community! I want to create my own dxDraw nametags, but I have one problem. Is this possible to make a loading dots effect? Like this one: I mean the black dots are go to 3 from 1, then it restarts. How is this possible? Can't find out how should I make this without problem. Link to comment
Anubhav Posted December 16, 2014 Share Posted December 16, 2014 You can create 3 texts and set thier alpha differently. Link to comment
Moderators IIYAMA Posted December 16, 2014 Moderators Share Posted December 16, 2014 1.1 Create 1 white dot with photoshop. (high quality png is most of the time better) https://wiki.multitheftauto.com/wiki/DxDrawImage 1.2 or https://wiki.multitheftauto.com/wiki/DxDrawText and use the • character. 2 Change the color of the image(white) or text tocolor(255,255,255,255) -- white tocolor(200,200,200,255) -- light gray tocolor(155,155,155,255) -- gray tocolor(55,55,55,255) -- dark gray tocolor(0,0,0,255) -- black 3 Use tickCount() to manage the progress. Link to comment
Dzsozi (h03) Posted December 16, 2014 Author Share Posted December 16, 2014 I don't want the text to fade, I just want to simulate the loading effect, that the dots are "growing" and if they reach 3 then it restarts. But how could I make this using getTickCount? Link to comment
Anubhav Posted December 16, 2014 Share Posted December 16, 2014 I don't want the text to fade, I just want to simulate the loading effect, that the dots are "growing" and if they reach 3 then it restarts. But how could I make this using getTickCount? If you use my idea, then create onClientRender and see if the 3rd text's alpha is that which you want. Link to comment
Dzsozi (h03) Posted December 16, 2014 Author Share Posted December 16, 2014 I don't understand what or how do you mean. Could you write an example or explain it please? Link to comment
Anubhav Posted December 16, 2014 Share Posted December 16, 2014 [lua] groups = { { r = 0, b = 0, g = 0, a = 255 }, {r = 0, g=0, b=0, a=255},{r=0,g=0,b=0,a=255}} addEventHandler("onClientRender", root, function ( ) dxDrawText( ) dxDrawText( ) dxDrawText( ) -- you have to divide your string into 3 parts somehow then for first text you can use the color code: groups[textNumber].r and as you see -- here keep changing the alpha if you want to lighten and darken -- then check if the alpha is 255 of last one first if it's then do it to first one end ) Link to comment
Dzsozi (h03) Posted December 16, 2014 Author Share Posted December 16, 2014 I've made something, but it's not working, well for the first frame it makes the effect, but after that there's gonna be a huge frame drop, and the text just bugs. It's not even above my head after my name. local typingTextGroups = {{ r=20, b=70, g=200, a=0 }, {r=20, g=70, b=200, a=0}, {r=20,g=70,b=200,a=0}} local typingText = "• " addEventHandler("onClientRender", root, function ( ) dxDrawText(typingText, additionalX,additionalY,0,0,tocolor(typingTextGroups[1].r, typingTextGroups[1].g, typingTextGroups[1].b, typingTextGroups[1].a),additionalScale,font,"left","top",false,false,false,true,true) dxDrawText(typingText .. "" .. typingText, additionalX,additionalY,0,0,tocolor(typingTextGroups[2].r, typingTextGroups[2].g, typingTextGroups[2].b, typingTextGroups[2].a),additionalScale,font,"left","top",false,false,false,true,true) dxDrawText(typingText .. "" .. typingText .. "" .. typingText, additionalX,additionalY,0,0,tocolor(typingTextGroups[3].r, typingTextGroups[3].g, typingTextGroups[3].b, typingTextGroups[3].a),additionalScale,font,"left","top",false,false,false,true,true) if typingTextGroups[1].a == 0 and typingTextGroups[2].a == 0 and typingTextGroups[3].a == 0 then typingTextGroups[1].a = 255 typingTextGroups[2].a = 0 typingTextGroups[3].a = 0 elseif typingTextGroups[1].a == 255 and typingTextGroups[2].a == 0 and typingTextGroups[3].a == 0 then typingTextGroups[1].a = 255 typingTextGroups[2].a = 255 typingTextGroups[3].a = 0 elseif typingTextGroups[1].a == 255 and typingTextGroups[2].a == 255 and typingTextGroups[3].a == 0 then typingTextGroups[1].a = 255 typingTextGroups[2].a = 255 typingTextGroups[3].a = 255 elseif typingTextGroups[1].a == 255 and typingTextGroups[2].a == 255 and typingTextGroups[3].a == 255 then typingTextGroups[1].a = 0 typingTextGroups[2].a = 0 typingTextGroups[3].a = 0 end end) Link to comment
.:HyPeX:. Posted December 16, 2014 Share Posted December 16, 2014 i belive you cannot use more than 1 and per if statement. 2 and i belive its not going to work. Link to comment
Dealman Posted December 16, 2014 Share Posted December 16, 2014 i belive you cannot use more than 1 and per if statement. 2 and i belive its not going to work. That is incorrect, I don't know if there's any direct limit for how many you can use, but I know that you can use more than 1 and 2 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