Creating a new OnUpdate function every time you run the command is fairly wasteful. You should also use the
elapsed value passed to your OnUpdate function, instead of calling GetTime() repeatedly.
Code:
local pull, seconds, onesec
local frame = CreateFrame("Frame")
frame:Hide()
frame:SetScript("OnUpdate", function(self, elapsed)
onesec = onesec - elapsed
pull = pull - elapsed
if pull <= 0 then
SendChatMessage("Pulling!", "RAID_WARNING")
self:Hide()
elseif onesec <= 0 then
SendChatMessage(seconds, "RAID_WARNING")
seconds = seconds - 1
onesec = 1
end
end)
SlashCmdList["COUNTDOWN"] = function(t)
t = tonumber(t) or 6
pull = t + 1
seconds = t
onesec = 1
frame:Show()
end
SLASH_COUNTDOWN1 = "/inc"