Jump to content

Marker Trouble


Recommended Posts


i was working on a mission , but i'm having problems with a marker .

Maybe you know where i've gone wrong.

so , a marker gets created on the Server Side when a player accepts the mission , and here is the client side.

local timers = { } 
function progress() 
 local loot  = getElementData(source,"lootmark") or false 
 if loot ~= true then return end 
timers[#timers+1] = setTimer( function () 
timers[#timers+1] = setTimer(outputChatBox, 1000, 1, "taking supplies - 10%") 
timers[#timers+1] = setTimer(outputChatBox, 3000, 1, "taking supplies - 20%") 
timers[#timers+1] = setTimer(outputChatBox, 6000, 1, "taking supplies - 30%") 
timers[#timers+1] = setTimer(outputChatBox, 9000, 1, "taking supplies - 100%") 
timers[#timers+1] = setTimer(outputChatBox, 12000, 1, "Mission Passed") 
end, 1000, 1) 
addEventHandler("onClientMarkerHit", root, progress) 
function noprogress() 
 local loot  = getElementData(source,"lootmark") or false 
 if loot ~= true then return end 
setTimer(outputChatBox, 300, 1, "You left the marker!") 
if isTimer(timers[1]) then 
for _ ,v in pairs ( timers ) do 
killTimer( v ) 
addEventHandler("onClientMarkerLeave", root, noprogress) 

so when he hits , the progress %age starts outputting.

But when he leaves the marker , i want it to stop. I used kill timer , but doesen't look like it worked.

i have set the element data of the marker on the server side as "lootmark"

Link to comment

First of all, why are you using that many timers? It` not needed at all. Get the timer details inside the timer for every second and run it 12 times. Then count the rest yourself. I think the problem with your code is that your`re checking if timers[1] is still active but by the time you leave the marker ( after 1 second ) it just kills itself because you`re only running it once. To solve this, delete line 19 and check the timers if they`re active inside the for loop.

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