mint3d Posted November 9, 2013 Share Posted November 9, 2013 ok i seen in a server it was a dx login and i was wondering how they done the top bit they made a rectangle i know how to do that but they had text in it moving any help? Link to comment
glowdemon1 Posted November 10, 2013 Share Posted November 10, 2013 You could create a variable : texpos = 0 and then it add a value to that variable each time the client renders a frame. Link to comment
tosfera Posted November 10, 2013 Share Posted November 10, 2013 Or just search the wiki for the GUI tutorials. https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_3 Link to comment
Dealman Posted November 10, 2013 Share Posted November 10, 2013 Or just search the wiki for the GUI tutorials.] That's not even the slightest helpful since he wants to work with DX, not GUI. 2 very, very different things. You can achieve what you want with interpolateBetween. Link to comment
tosfera Posted November 10, 2013 Share Posted November 10, 2013 Or just search the wiki for the GUI tutorials.] That's not even the slightest helpful since he wants to work with DX, not GUI. 2 very, very different things. You can achieve what you want with interpolateBetween. "ok i seen in a server it was a dx login and i was wondering how they done the top bit they made a rectangle i know how to do that but they had text in it moving any help?" He only mentioned a dx login and moving text. Not a way how to create the moving text. Link to comment
mint3d Posted November 10, 2013 Author Share Posted November 10, 2013 Or just search the wiki for the GUI tutorials. Hes right i only said dx login but i think the moving text was dx but im not sure ill try it out tho Link to comment
-.Paradox.- Posted November 10, 2013 Share Posted November 10, 2013 https://community.multitheftauto.com/index.php?p= ... ls&id=7970 Link to comment
mint3d Posted November 10, 2013 Author Share Posted November 10, 2013 I mean like SAUR's login the moving text I mean like that Link to comment
Gallardo9944 Posted November 11, 2013 Share Posted November 11, 2013 local x,y = guiGetScreenSize() local textPosition = 0 -- Main counter. You can do the same with anything you want to move or change per frame. local text = "This text is moving right!" function renderText() textPosition = textPosition + 1 -- Move by one pixel each frame if textPosition > x then -- If the text is out of the screen textPosition = 0 -- Make it come back to the default position end dxDrawText(text,textPosition,y/2,x,y) -- draw the text end addEventHandler("onClientRender",getRootElement(),renderText) Should be a good example. Unstested though. Link to comment
mint3d Posted November 11, 2013 Author Share Posted November 11, 2013 That works great thanks, one question how to I get it to stop? addEventHandler ( "onClientGUIClick", loginButton) function() destroyElement(renderText) end ) Link to comment
Gallardo9944 Posted November 11, 2013 Share Posted November 11, 2013 nope, renderText is not an element but a function. You've gotta pause it somehow. You can either split functions like this: local x,y = guiGetScreenSize() local textPosition = 0 -- Main counter. You can do the same with anything you want to move or change per frame. local text = "This text is moving right!" function renderText() dxDrawText(text,textPosition,y/2,x,y) -- draw the text end addEventHandler("onClientRender",getRootElement(),renderText) function renderAnimation() textPosition = textPosition + 1 -- Move by one pixel each frame if textPosition > x then -- If the text is out of the screen textPosition = 0 -- Make it come back to the default position end addEventHandler("onClientPreRender",getRootElement(),renderAnimation) -- Applying the animation before rendering the text to make animation work properly addEventHandler ( "onClientGUIClick",loginButton,function() removeEventHandler("onClientPreRender",getRootElement(),renderAnimation) -- Removing the animation. You can also remove event handler for renderText if you want to remove the text completely end) Or this (use a variable to specify if it should animate more): local x,y = guiGetScreenSize() local textPosition = 0 -- Main counter. You can do the same with anything you want to move or change per frame. local text = "This text is moving right!" local animate = true function renderText() if animate == true then -- If we want to animate stuff textPosition = textPosition + 1 if textPosition > x then textPosition = 0 end end dxDrawText(text,textPosition,y/2,x,y) -- draw the text -- Add this into the "if" check if you don't want to draw it anymore end addEventHandler("onClientRender",getRootElement(),renderText) addEventHandler ( "onClientGUIClick",loginButton,function() animate = false -- Stop animating. end) Of course, the second way is nice when you have to animate the stuff often, but without a complete removal of the text. Link to comment
mint3d Posted November 11, 2013 Author Share Posted November 11, 2013 I only want it to animate it on login like a welcome to going across the top I got the pos right just need to know how to stop it Link to comment
Gallardo9944 Posted November 11, 2013 Share Posted November 11, 2013 Use the first way. Remove both animate and render handlers. Link to comment
mint3d Posted November 11, 2013 Author Share Posted November 11, 2013 use this? local x,y = guiGetScreenSize() local textPosition = 0 -- Main counter. You can do the same with anything you want to move or change per frame. local text = "This text is moving right!" function renderText() dxDrawText(text,textPosition,y/2,x,y) -- draw the text end addEventHandler("onClientRender",getRootElement(),renderText) function renderAnimation() textPosition = textPosition + 1 -- Move by one pixel each frame if textPosition > x then -- If the text is out of the screen textPosition = 0 -- Make it come back to the default position end addEventHandler("onClientPreRender",getRootElement(),renderAnimation) -- Applying the animation before rendering the text to make animation work properly addEventHandler ( "onClientGUIClick",loginButton,function() removeEventHandler("onClientPreRender",getRootElement(),renderAnimation) -- Removing the animation. You can also remove event handler for renderText if you want to remove the text completely end) 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