1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Time config, on what "time" should the server start
hour = 12
min = 0
// how many in-game-minutes are a real second
speed = 1
// this will map the start time to the corresponding lightlevel
lightlevel = (90 + (hour * 60 + min) * speed / 4) % 360
// the speed / 4 comes from the fact that a day have 24 * 60 = 1440 min
// and the lightlevel can be between 0 and 360 => you have a ratio from 1/4
addhook("second","time")
function time()
	lightlevel = lightlevel + speed / 4
	parse("sv_daylighttime "..lightlevel)
	if lightlevel >= 360 then
		lightlevel = 0
	end
	min = min + speed
	if min >= 60 then
		hour = hour + 1
		min = 0
		if hour >= 24 then
			hour = 0
		end
	end
end