• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Globalevent script

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,325
Reaction score
136
Hello once again i got an issue with raids script i cant set hourly raids can someone please help me or fix the code? :)
no errors. i use 0.4
what i want to do is that i can set some raids to happend every 15 minutes , or every 2 hour or 1 :)
would be nice if someone could help :)

script
PHP:
--[[
- hour should be exact SERVER hour
- to do the raid at clock 00 minutes 00
- to do the raid at exaxt date use type "exact"
- to do the raid weekly use type "weekly"
- days names are used only for weekly type and should be
- "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"
- also should be inside a array -> {}
]]

local raids =
    {
        [1] =
            {
                name = 'morga',
                type = 'hourly',
                minu = 1
            },
        [2] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'tuesday'},
                hour = 20,
                minu = 00
            },
        [3] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'monday'},
                hour = 8,
                minu = 00
            },
        [4] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'wednesday'},
                hour = 12,
                minu = 00
            },
        [5] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'thursday'},
                hour = 10,
                minu = 00
            },
        [6] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'sunday'},
                hour = 15,
                minu = 00
            },
        [7] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'tuesday'},
                hour = 10,
                minu = 00
            },
        [8] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'saturday'},
                hour = 22,
                minu = 00
            },
        [9] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'monday'},
                hour = 16,
                minu = 00
            },
        [10] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'sunday'},
                hour = 8,
                minu = 00
            },
        [11] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'thursday'},
                hour = 20,
                minu = 00
            },
        [12] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'wednesday'},
                hour = 8,
                minu = 00
            },
        [13] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'sunday'},
                hour = 18,
                minu = 00
            },
        [14] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'saturday'},
                hour = 6,
                minu = 00
            },
        [15] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'friday'},
                hour = 4,
                minu = 00
            },
        [16] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'tuesday'},
                hour = 5,
                minu = 00
            },
        [17] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'wednesday'},
                hour = 19,
                minu = 00
            },
        [18] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'thursday'},
                hour = 20,
                minu = 00
            },
        [19] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'friday'},
                hour = 12,
                minu = 00
            },
        [20] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'monday'},
                hour = 11,
                minu = 00
            },
        [21] =
            {
                name = 'morga',
                type = 'weekly',
                days = {'tuesday'},
                hour = 3,
                minu = 00
            },
        [22] =
            {
                name = 'apocalypses',
                type = 'weekly',
                days = {'tuesday'},
                hour = 20,
                minu = 00
            },
        [23] =
            {
                name = 'apocalypses',
                type = 'weekly',
                days = {'friday'},
                hour = 18,
                minu = 00
            },
        [24] =
            {
                name = 'goblins',
                type = 'exact',
                date = {day = 28, month = 5},
                hour = 17,
                minu = 00
            }  
    }
  
local last_execsutes = {}

function onThink(interval, lastExecution, thinkInterval)
    local static_time = os.time()
    for k, raid in ipairs(raids) do
        if (raid.type == 'weekly') then
            local day = os.date("%A", static_time):lower()
            if isInArray(raid.days, day) then
                local hour = tonumber(os.date("%H", static_time))
                if (raid.hour == hour) then
                    local minute = tonumber(os.date("%M", static_time))
                    if (raid.minu == minute) then
                        local day_number = tonumber(os.date("%d", static_time))
                        if (last_execsutes[k] ~= day_number) then
                            last_execsutes[k] = day_number
                            doExecuteRaid(raid.name)
                        end
                    end
                end
            end
        elseif (raid.type == 'hourly') then
            local minute = tonumber(os.date("%M", static_time))
                if (00 == minute) then
                    doExecuteRaid(raid.name)
                end
        elseif (raid.type == 'exact') then
            local month = tonumber(os.date("%m", static_time))
            if (raid.date.month == month) then
                local day = tonumber(os.date("%d", static_time))
                if (raid.date.day == day) then
                    local hour = tonumber(os.date("%H", static_time))
                    if (raid.hour == hour) then
                        local minute = tonumber(os.date("%M", static_time))
                        if (raid.minu == minute) then
                            if (last_execsutes[k] ~= day) then
                                last_execsutes[k] = day
                                doExecuteRaid(raid.name)
                            end
                        end
                    end
                end
            end
        end
    end
    return true
end
 
Last edited:
i even scared to say bump or help or even make new theard since that PRO guy gonna start biting like some bitchc with doesnt get enought ettention from customers ^^

I'm seeing this kind of childish fight more often at the site, and it's always the same people... You guys are turning this site into something toxic, go fight to private messages, no one cares about ur sh*t!!!
I agreee this forum was so alive before ^^

BUMP...
 
i even scared to say bump or help or even make new theard since that PRO guy gonna start biting like some bitchc with doesnt get enought ettention from customers ^^


I agreee this forum was so alive before ^^

BUMP...
1st off you aren't a customer, to be a customer requires some form of barter or payment and I highly doubt you could afford mine or anyone else's services.

2nd, The reason this community is dying is because of ungrateful people such are yourself who feel as if they are entitled to special treatment because they spent a few $$ on a premium account, your account status does not guarantee you anything but a thank you from the people or organization you purchased it from.

3rd Stop being a dick.
 
4th, Quit being lazy. You claim to have been working on different ot projects for 5 years but can't even do some simple changes? Sounds more like other people have been making all your ots for you.
 
Back
Top Bottom