PtokaX forum

Development Section => Your Developing Problems => Topic started by: Jemte on 22 January, 2005, 20:33:42

Title: multiple timers
Post by: Jemte on 22 January, 2005, 20:33:42
timer_reason = nil
user = nil

function NewUserConnected(curUser)
  user = curUser
  SetTimer(3000)
  if (curUser.sName==badname) then
     timer_reason = "msgbadnick"
     StartTimer()
  end
end

function OnTimer()
  if (timer_reason=="msgbadnick") then
    MsgBadNick()
  end
  if (timer_reason=="banbadnick") then
    BanBadNick()
  end
end

function MsgBadNick()
  StopTimer()

  SetTimer(30000)
  StartTimer()
  timer_reason = "banbadnick"
end

function BanBadNick()
  StopTimer()

  user:TimeBan(1)
end

the code just seems to run through everything in the OnTimer event even though i stopped the timer before i set and started it with the new time.
Title:
Post by: bastya_elvtars on 23 January, 2005, 14:27:48
http://lua.uknnet.com/thread.php?sid=&postid=4143#post4143