undefined Posted February 8, 2014 Share Posted February 8, 2014 (edited) Hi Guys. I have a problem. Screen comes in 5 minutes. But not close. Where is my mistake? local sWidth, sHeight = guiGetScreenSize() local show = false local tick = getTickCount ( ) local endTick = nil addEventHandler("onClientRender", root, function ( ) if ( getTickCount ( ) - tick >= 300000 ) then show = true endTick = getTickCount ( ) + 30000 if ( getTickCount ( ) >= endTick ) then show = false tick = getTickCount ( ) end end if ( show ) then dxDrawImage((sWidth/2)-250, sHeight-sHeight-15, 160, 140, "images/HubbubGames.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage((sWidth/2)+90, sHeight-sHeight-15, 160, 140, "images/HubbubGames.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawLine((sWidth/2+120), sHeight-sHeight+65, (sWidth/2-120), sHeight-sHeight+65, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Welcome To", (sWidth/2), 0, (sWidth/2), 31, tocolor(255, 255, 255, 255),1.00, "bankgothic", "center", "top", false, false, false) dxDrawText("Hubbub Games", (sWidth/2), 31, (sWidth/2), 62, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, false) dxDrawText("New Forum Adress:", (sWidth/2), 72, (sWidth/2), 89, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false) dxDrawText("www.HubbubGames.com", (sWidth/2), 89, (sWidth/2), 106, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false) end end ) Edited February 8, 2014 by Guest Link to comment
myonlake Posted February 8, 2014 Share Posted February 8, 2014 Because you are always re-defining the endTick variable. You have to make sure endTick is nil before you set it. local sWidth, sHeight = guiGetScreenSize( ) local show = false local tick = getTickCount( ) local endTick = nil addEventHandler( "onClientRender", root, function( ) if ( getTickCount( ) - tick >= 300000 ) then show = true if ( not endTick ) then endTick = getTickCount( ) + 30000 end if ( getTickCount( ) >= endTick ) then show = false endTick = nil tick = getTickCount( ) end end if ( show ) then dxDrawImage( ( sWidth / 2 ) - 250, sHeight - sHeight - 15, 160, 140, "images/HubbubGames.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), false ) dxDrawImage( ( sWidth / 2 ) + 90, sHeight - sHeight - 15, 160, 140, "images/HubbubGames.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), false ) dxDrawLine( ( sWidth / 2 + 120), sHeight - sHeight + 65, (sWidth / 2 - 120 ), sHeight - sHeight + 65, tocolor( 255, 255, 255, 255 ), 1, false ) dxDrawText( "Welcome To", ( sWidth / 2 ), 0, ( sWidth / 2 ), 31, tocolor( 255, 255, 255, 255 ), 1.00, "bankgothic", "center", "top", false, false, false ) dxDrawText( "Hubbub Games", ( sWidth / 2 ), 31, ( sWidth / 2 ), 62, tocolor( 255, 255, 255, 255 ), 1.00, "bankgothic", "center", "top", false, false, false ) dxDrawText( "New Forum Adress:", ( sWidth / 2 ), 72, ( sWidth / 2 ), 89, tocolor( 255, 255, 255, 255 ), 1.00, "default-bold", "center", "top", false, false, false ) dxDrawText( "www.HubbubGames.com", ( sWidth / 2 ), 89, ( sWidth / 2 ), 106, tocolor( 255, 255, 255, 255 ), 1.00, "default-bold", "center", "top", false, false, false ) end end ) Also, keep in mind that you are always resetting the tick. You should make a variable defining if the thing has been shown already to the client, and if it has, then don't show it again (unless you want to repeatedly keep showing the welcome menu to the client). Or then simply just put the addEventHandler in somewhere and call for removeEventHandler after a while, this way you won't keep rendering blanks. 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