i hope this does work

This commit is contained in:
2024-03-28 00:01:06 +01:00
parent 92b051e5a2
commit a18f412b2b
2 changed files with 21 additions and 7 deletions

View File

@@ -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
// Winter time
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
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

View File

@@ -1,6 +1,6 @@
local conf = {
[71880] = '"Dies ist ein test Text!"'
[85200] = '"Dies ist ein test Text!"'
}