Jump to content

Solved


undefined

Recommended Posts

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 by Guest
Link to comment

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

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