Jump to content

Kill a timer


FSXTim

Recommended Posts

Hallo,

I want to kill the timer in this script. But now all the timers of the resource are killed. How can I only kill this one?

function spam(message, messageType) 
    local player = source 
    local msg = getElementData(source, "Spam") 
    if message == msg then 
        outputChatBox("Bitte wiederhole dich nicht!", source, 255, 0, 0) 
        cancelEvent() 
    end 
    timers = getTimers(10000) 
    for timerKey, timerValue in ipairs(timers) do 
      killTimer(timerValue) 
    end 
    setTimer( 
        function() 
            setElementData(player, "Spam", "0") 
        end  
    , 10000, 1) 
    setElementData(source, "Spam", message)      
end 
addEventHandler("onPlayerChat", getRootElement(), spam) 

Greets

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