diff --git a/lua/sca_main.lua b/lua/sca_main.lua index 13ccd13..abe07ee 100644 --- a/lua/sca_main.lua +++ b/lua/sca_main.lua @@ -34,13 +34,14 @@ local function sca_setup_timezone() year = year + 1 end - for (month, 11, 1) do + for i = 0, 11, 1 do if (daysPastUnixYear - daysPerMonth[i] >= daysPerMonth[i]) then if (i == 2 && (year % 4 == 0 && (year % 400 == 0 && year % 100 != 0))) then daysPastUnixYear = daysPastUnixYear - (daysPerMonth[i] + 1) else daysPastUnixYear = daysPastUnixYear - daysPerMonth[i] end + month = month + 1 else day = daysPastUnixYear - 1 break @@ -49,15 +50,28 @@ local function sca_setup_timezone() local hourInSeconds = time % 86400 - if (month >= 2 && month <= 9) then - // Summer time - + if (month > 2 && month < 9) then + summerTime = true + elseif (month == 2) then + // If its less than 6 days until end of the month (aka last Weekday in the month) and its sunday and its 3 am or later.... + if ((daysPerMonth[month] - day <= 6) && weekDay == 3 && hoursInSeconds >= 10800) then + summerTime = true + else + summerTime = false + end + elseif (month == 9) then + // The same action again but for winter time + if ((daysPerMonth[month] - day <= 6) && weekDay == 3 && hoursInSeconds >= 10800) then + summerTime = false + else + summerTime = true + end else - // Winter time - + summerTime = false end end +// Odd... Windows returns timezoned os.time, hmmm.... Need to check it on Linux local function sca_msg_to_player(time) if (msg[time] != nil) then for k, v in ipairs(player.GetHumans()) do diff --git a/lua/sca_msg.lua b/lua/sca_msg.lua index f8d1d9e..f3d765c 100644 --- a/lua/sca_msg.lua +++ b/lua/sca_msg.lua @@ -1,6 +1,6 @@ local conf = { - [71880] = '"Dies ist ein test Text!"' + [85200] = '"Dies ist ein test Text!"' }