Jump to content

timer problem


Kenix

Recommended Posts

there is a problem with the resource missiontimer

When the timer starts next / map strays that have to do to the timer does not strayed?

I wish that the time is not continued and began to re-

Here's the script.

  
function loadmap() 
local resourceName = getResourceName ( resource ) 
    g_TimeLimit = (tonumber(get(resourceName..".time_limit")) and math.floor(tonumber(get(resourceName..".time_limit"))) or defaults.timeLimit)*1000 
        g_MissionTimer = exports.missiontimer:createMissionTimer (g_TimeLimit,true,true,0.5,20,true,"default-bold",1) 
        addEventHandler ( "onMissionTimerElapsed", g_MissionTimer, onTimeElapsed ) 
end 
addEventHandler("onGamemodeMapStart",getRootElement(), loadmap) 
  
function stopmap() 
        removeEventHandler ( "onMissionTimerElapsed", g_MissionTimer, onTimeElapsed ) 
end 
addEventHandler("onGamemodeMapStop",getRootElement(),stopmap) 
  
  
  

Link to comment

still does not work :(

  
local g_MissionTimer,g_TimeLimit 
  
function loadmap() 
local resourceName = getResourceName ( resource ) 
    g_TimeLimit = (tonumber(get(resourceName..".time_limit")) and math.floor(tonumber(get(resourceName..".time_limit"))) or defaults.timeLimit)*1000 
        g_MissionTimer = exports.missiontimer:createMissionTimer (g_TimeLimit,true,true,0.5,20,true,"default-bold",1) 
        addEventHandler ( "onMissionTimerElapsed", g_MissionTimer, onTimeElapsed ) 
end 
addEventHandler("onGamemodeMapStart",getRootElement(), loadmap) 
  
function stopmap() 
        removeEventHandler ( "onMissionTimerElapsed", g_MissionTimer, onTimeElapsed ) 
        destroyElement(g_MissionTimer,g_TimeLimit) 
end 
addEventHandler("onGamemodeMapStop",getRootElement(),stopmap) 
  

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