Jump to content

Missiontimer bug?


Castillo

Recommended Posts

Hello, i have a problem using this resource "missiontimer", well, i made a timer, that worked fine, but then i want to change/destroy this timer and i cannot.

missiontime = exports.missiontimer:createMissionTimer (times*6000,true,"%m:%s",0.5,20,true,"default-bold",1,255,255,255) 
exports.missiontimer:setMissionTimerTime(missiontime,times*6000) 

Could someone explain me why this won't work?

Thanks in advance.

Link to comment

use this

create time

  
local defaults = { 
    timeLimit = 300,     
} 
  
  
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 )   
  

destroy

  
removeEventHandler ( "onMissionTimerElapsed", g_MissionTimer, onTimeElapsed ) 
destroyElement(g_MissionTimer,g_TimeLimit) 
  

Map meta add time limit:

  
"#time_limit" value="[ 300 ]" /> 
  

I have the same standing on the my zombie mode server :)

Link to comment

this is a copy-paste from my resource, last time i checked it worked:

addEventHandler("onclientfirstplayerDEAD", getRootElement(), function(ttime)  
    dely_MissionTimer = exports.missiontimer:createMissionTimer (ttime,true,"%m:%s",0.5,0.08,true,"default-bold",1,255,255,255)  
    shoot = false 
end) 
addEventHandler("onclientpausestop", getRootElement(), function() 
    if isElement(dely_MissionTimer) then  
        destroyElement(dely_MissionTimer)  
    end  
    shoot = true 
end) 

this is client side, but it also worked serverside...

Link to comment

I'm still having the same problem, this is what it outputs to debug when it should be destroyed.

WARNING: Bad 'element' pointer @ 'triggerEvent'(2)

Edit: Woah, i inserted the timer into a command and now it get's destroyed o,o, really weird.

Edit2: Now i'm trying to use it onResourceStart and it won't work :roll:

Edit3: I've got it working, sounds like the problem was with the exporting functions, since i put all the files into my resource and works fine.

Thanks for help everyone.

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