Jump to content

[HELP] Use of timer


joao1234

Recommended Posts

function showClientImage() 
   imgButton = guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
function onImgClick(button, state, absoluteX, absoluteY) 
  if (source == imgButton) then 
     ---your code 
     destroyElement(imgButton) 
     setTimer(showClientImage, 60000, 1) 
   end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onImgClick) 

or without destroy image

function showClientImage() 
   imgButton = guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false ) 
   addEventHandler ("onClientGUIClick", getRootElement(), onImgClick)  
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage ) 
  
function onImgClick(button, state, absoluteX, absoluteY) 
  if (source == imgButton) then 
     ---your code 
     removeEventHandler ("onClientGUIClick", getRootElement(), onImgClick) 
     setTimer(function()  
        addEventHandler ("onClientGUIClick", getRootElement(), onImgClick)  
     end, 60000, 1) 
   end 
end 

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