Jump to content

Countdown Help


imCEASER

Recommended Posts

Sorry, I forgot to put the code

function Contar ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/1.png", false ) 
    setTimer ( Contar1, 1000, 1 ) 
end 
  
function Contar1 ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/2.png", false ) 
    setTimer ( Contar2, 1000, 1 ) 
end 
  
function Contar2 ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/3.png", false ) 
    setTimer ( Contar3, 1000, 1 ) 
end 
  
function Contar3 ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/4.png", false ) 
    setTimer ( Contar4, 1000, 1 ) 
end 
  
function Contar4 ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/5.png", false ) 
    setTimer ( Contar5, 1000, 1 ) 
end 
  
function Contar5 ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/6.png", false ) 
    setTimer ( Contar6, 1000, 1 ) 
end 
  
function Contar6 ( source ) 
    guiSetVisible ( imgcontador, true ) 
    imgcontador = guiCreateStaticImage( 305, 119, 110, 190, "imagens/contador1/7.png", false ) 
    setTimer ( FimContador, 1000, 1 ) 
end 
  
function FimContador ( source ) 
    guiSetVisible ( imgcontador, false ) 
end 
  
addCommandHandler ( "contar1", Contar ) 

Link to comment

try this:

client

local startTick = nil 
local timeToEachCounter = 1000 
local imageNumbers = 7 
local imageCurrent = 0 
  
function draw() 
local now = getTickCount() 
if(now - startTick >= timeToEachCounter)then 
startTick = now 
if(imageCurrent == imageNumbers)then 
removeEventHandler("onClientRender",root,draw) 
else 
imageCurrent = imageCurrent +1 
end 
end 
dxDrawImage(305, 119, 110, 190,"imagens/contador1/"..imageCurrent..".png") 
end 
  
addEvent("onStartCounter",true) 
addEventHandler("onStartCounter",root, 
function() 
startTick = getTickCount() 
imageCurrent = 0 
addEventHandler("onClientRender",root,draw) 
end) 
  

server

-- server 
  
addCommandHandler("contar1", 
function(p) 
triggerClientEvent("onStartCounter",p) 
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...