Jump to content

dxDrawImage problem


Newbie

Recommended Posts

Hello, i need some help guys.

function renderDisplay ( ) 
    local seconds = getTickCount() / 10000 
    dxDrawImage ( 0,0, 1000, 500, 'data/img/infernusai.png', angle, 0, 0 ) 
end 
function HandleTheRendering ( ) 
    addEventHandler("onClientRender", getRootElement(), renderDisplay) 
end 
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) 
addCommandHandler ( "bibis", renderDisplay ) 
  

it keeps image all the time, i need to show it only for 10 seconds.. Can someone help me ?

Link to comment
  • Other Languages Moderators

Try this:

local init_tick 
  
function renderDisplay ( ) 
    local elapsed_seconds = ( getTickCount ( ) - init_tick ) / 1000 
  
    if ( elapsed_seconds >= 10 ) then -- the part where you specify how many seconds it should stay until it disappears 
        init_tick = nil 
  
        removeEventHandler ( "onClientRender", getRootElement(), renderDisplay ) 
    end 
  
    dxDrawImage ( 0,0, 1000, 500, 'data/img/infernusai.png', angle, 0, 0 ) 
end 
  
function HandleTheRendering ( ) 
    if ( init_tick ) then 
        return 
    end 
  
    init_tick = getTickCount ( ) 
  
    addEventHandler("onClientRender", getRootElement(), renderDisplay) 
end 
addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) 
addCommandHandler ( "bibis", HandleTheRendering ) 

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