Lbtg
Intermediate OT User
- Joined
- Nov 22, 2008
- Messages
- 2,324
- 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
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: