quest auto_events begin
state start begin
when 9004.chat."Auto Eveniment" with pc.is_gm() begin
say_title(" Salutare "..pc.get_name())
say(" Setati acum "..game.get_event_flag("autoevent").." ")
say(" ")
local s = select(" Activeaza "," Dezactiveaza "," Inchide ")
if s == 1 then
setskin(NOWINDOW)
server_loop_timer("auto_event_timer", 1)
game.set_event_flag("autoevent", 1)
elseif s == 2 then
setskin(NOWINDOW)
clear_server_timer("auto_event_timer")
game.set_event_flag("autoevent", 0)
end
end
when auto_event_timer.server_timer begin
local events_info = {
{"Sat 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Sat 19:00", 0},
{"Sun 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Sun 19:00", 0},
{"Mon 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Mon 19:00", 0},
{"Tue 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Tue 19:00", 0},
{"Wed 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Wed 19:00", 0},
{"Thu 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Thu 19:00", 0},
{"Fri 18:00", "Cufãr Lumina Lunii", "event", "mondlicht_event", 1, " 1 ora. ", "Fri 19:00", 0},
}
local day_time = os.date("%a %H:%M")
for i,v in ipairs(events_info) do
if v[1] == day_time then
if game.get_event_flag(v[4]) != v[5] then
notice_all("Notificare: Evenimentul "..v[2].." activat timp de "..v[6].."Succes !!!")
game.set_event_flag(v[4], v[5])
end
elseif v[7] == day_time then
if game.get_event_flag(v[4]) != v[8] then
notice_all("Notificare: Evenimentul "..v[2].." terminat. ")
game.set_event_flag(v[4], v[8])
end
end
end
end
end
end