Ir para conteúdo

Featured Replies

Postado
<globalevent name="RaidSystem" interval="10000" script="raids.lua"/>
local raids = {
    -- Weekly
    ['Monday'] = {
        ['08:00'] = {raidName = 'RatsThais'},
 
        ['15:00'] = {raidName = 'Arachir the Ancient One'}
    },
 
    ['Wednesday'] = {
        ['12:00'] = {raidName = 'OrcsThais'}
    },
 
    -- By date (Day/Month)
    ['31/10'] = {
        ['16:00'] = {raidName = 'Halloween Hare'}
    }
}
 
function onThink(interval, lastExecution, thinkInterval)
    local day, date = os.date('%A'), getRealDate()
 
    local raidDays = {}
    if raids[day] then
        raidDays[#raidDays + 1] = raids[day]
    end
   
    if raids[date] then
        raidDays[#raidDays + 1] = raids[date]
    end
 
    if #raidDays == 0 then
        return true
    end
 
    for i = 1, #raidDays do
        local settings = raidDays[i][getRealTime()]
        if settings and not settings.alreadyExecuted then
            Game.startRaid(settings.raidName)
            settings.alreadyExecuted = true
        end
    end
 
    return true
end
 
local function getRealTime()
    local hours = tonumber(os.date("%H", os.time()))
    local minutes = tonumber(os.date("%M", os.time()))
 
    if hours < 10 then
        hours = '0' .. hours
    end
    if minutes < 10 then
        minutes = '0' .. minutes
    end
    return hours .. ':' .. minutes
end
 
local function getRealDate()
    local month = tonumber(os.date("%m", os.time()))
    local day = tonumber(os.date("%d", os.time()))
 
    if month < 10 then
        month = '0' .. month
    end
    if day < 10 then
        day = '0' .. day
    end
    return day .. '/' .. month
end

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.9k

Informação Importante

Confirmação de Termo