mint3d Posted November 16, 2013 Share Posted November 16, 2013 I need some help on this code I made When I login it still shows 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 = "MOTD: Welcome to the server have fun!" 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,0.2/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) dxDrawRectangle ( x/2.2, y/2000, x/0, y/25, tocolor ( 0, 0, 0, 255 ) ) -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- draw the text -- Add this into the "if" check if you don't want to draw it anymore dxDrawText(text,textPosition,0/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) end addEventHandler("onClientRender",getRootElement(),renderText) addEventHandler ( "onClientGUIClick",loginButton,function() animate = false -- Stop animating. end) Link to comment
TAPL Posted November 16, 2013 Share Posted November 16, 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 = "MOTD: Welcome to the server have fun!" 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 dxDrawText(text,textPosition,0.2/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) dxDrawRectangle ( x/2.2, y/2000, x/0, y/25, tocolor ( 0, 0, 0, 255 ) ) -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- draw the text -- Add this into the "if" check if you don't want to draw it anymore dxDrawText(text,textPosition,0/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) end end addEventHandler("onClientRender",getRootElement(),renderText) addEventHandler ( "onClientGUIClick",loginButton,function() animate = false -- Stop animating. end) Link to comment
mint3d Posted November 16, 2013 Author Share Posted November 16, 2013 Didnt work If it would be easier we could use onClientPLayerSpawn 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 = "MOTD: Welcome to the server hope you have fun!" 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 dxDrawText(text,textPosition,0.2/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) dxDrawRectangle ( x/2.2, y/2000, x/0, y/25, tocolor ( 0, 0, 0, 255 ) ) -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- Create our black transparent MOTD background Rectangle. -- draw the text -- Add this into the "if" check if you don't want to draw it anymore dxDrawText(text,textPosition,0/2,x,y, tocolor ( 255, 255, 255, 1000 ), 1.5, "default-bold" ) end end addEventHandler("onClientRender",getRootElement(),renderText) addEventHandler ( "onClientGUIClick",bLogin,function() animate = false -- Stop animating. end) Link to comment
tosfera Posted November 16, 2013 Share Posted November 16, 2013 You could do that ya, or just remove the onClientRender event when the player logs in. Would be a cleaner solution. So the render isn't checking the if-statement over and over again. Link to comment
mint3d Posted November 16, 2013 Author Share Posted November 16, 2013 What do you mean remove onClientRender it needs that for it to work doesn't it? Link to comment
tosfera Posted November 16, 2013 Share Posted November 16, 2013 What do you mean remove onClientRender it needs that for it to work doesn't it? This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them. You want to remove the dx right? Then just remove the event. Link to comment
mint3d Posted November 16, 2013 Author Share Posted November 16, 2013 I don't know what you mean show me? 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