Jump to content

Need some help


mint3d

Recommended Posts

Posted

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?

Skype: Jordan_Nymph

Posted
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.

If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.

Posted
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.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted
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

Skype: Jordan_Nymph

Posted
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.

Posted

That works great thanks, one question how to I get it to stop?

    addEventHandler ( "onClientGUIClick", loginButton) 
  
function() 
  
        destroyElement(renderText) 
    end 
) 

Skype: Jordan_Nymph

Posted

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.

Posted

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

Skype: Jordan_Nymph

Posted

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) 

Skype: Jordan_Nymph

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...