Jump to content

zetox1

Recommended Posts

Hi gyus 

 

I'm new here and can you tell me if it's possible to make counter which will be counting down 10.9.8.7.6.....to 0 and again. 10.9.8.7.6.... and after map loading it will start counting down again. 

 

And one important thing it have start always after 3.2.1.GO

Link to comment

I think about something like this 

 

I have found it on other topic but it have to restart after map loading: 

 

local sX,sY = guiGetScreenSize() 
local counter = 10 
local r,g,b = 0,255,0 
  
function drawCounterSHI() 
    dxDrawText("Your vehicle will change in: "..counter,0,sY*0.8,sX,sY,tocolor(r,g,b,255),2,"default","center","top",false,false,false) 
end 
  
function startEverything() 
addEventHandler("onClientRender",root,drawCounterSHI) 
setTimer(function() 
    counter = counter - 1 
    if counter < 0 then 
        counter = 15 
        r,g,b = 0,255,0 
    end 
    if counter <= 3 then 
        r,g,b = 255,0,0 
    end 
end,1000,0) 
  
end 
addEvent("onCounterStart",true) 
addEventHandler("onCounterStart",getRootElement(),startEverything) 

Any ideas how to solve it ? 

I tried use but i dont know how to do it

resetTimer
Link to comment
29 minutes ago, zetox1 said:

I think about something like this 

 

I have found it on other topic but it have to restart after map loading: 

 


local sX,sY = guiGetScreenSize() 
local counter = 10 
local r,g,b = 0,255,0 
  
function drawCounterSHI() 
    dxDrawText("Your vehicle will change in: "..counter,0,sY*0.8,sX,sY,tocolor(r,g,b,255),2,"default","center","top",false,false,false) 
end 
  
function startEverything() 
addEventHandler("onClientRender",root,drawCounterSHI) 
setTimer(function() 
    counter = counter - 1 
    if counter < 0 then 
        counter = 15 
        r,g,b = 0,255,0 
    end 
    if counter <= 3 then 
        r,g,b = 255,0,0 
    end 
end,1000,0) 
  
end 
addEvent("onCounterStart",true) 
addEventHandler("onCounterStart",getRootElement(),startEverything) 

Any ideas how to solve it ? 

I tried use but i dont know how to do it


 
  1. resetTimer

g

getTimerDetails

 

Link to comment

If marty is right then you must assign the timer to a variable, and reset the counter variable to the default value (10 or 15, dunno) when the map start. Resetting the timer does nothing since it is build on the variable and not the timer itself, but it will "sync" the start time with the map start, so if you want reset the timer on new map start

Edited by LoPollo
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...