View difference between Paste ID: bSQBB6VH and yycEdier
SHOW: | | - or go back to the newest paste.
1
--[[
2
=========CONFIGURATION=========
3
Add whatever maps you want below in a new column like so:
4
local maps={
5
"gm_construct",
6
"gm_flatgrass",
7
"newthing",
8
"anotherthing"
9
}
10
etc.  MAKE SURE IT'S BETWEEN THE BRACKETS!!!
11
]]
12
local maps={
13
"gm_construct", --All but last have a comma at the end
14
"gm_flatgrass" --Last doesn't have a comma
15
}
16
--[[
17
Here is the amount of time (in minutes) between each map change.
18
]]
19
local TIME_UNTIL_CHANGE=10
20
21
-----DON'T TOUCH ANYTHING UNDER HERE-----
22
local changetime=TIME_UNTIL_CHANGE*60
23
hook.Add("InitPostEntity", "startMapChange", function()
24
	changetime=CurTime()+changetime
25
	timer.Simple(TIME_UNTIL_CHANGE*60, changeMap())
26
end)
27
28
29
function changeMap()
30
	local map=game.GetMap()
31
	local ind=(table.KeyFromValue(map) or 0)+1
32
	if ind and maps[ind] then
33
		RunConsoleCommand("changelevel", maps[ind])
34
	else
35
		RunConsoleCommand("changelevel", maps[1])
36
	end
37
end
38
39
function NotifyForChange()
40
	local timeleft=changetime-CurTime()
41
	local mins=math.floor(timeleft/60)
42
	for f, v in pairs(player.GetAll()) do
43
		if mins==0 then
44
			mins=timeleft
45
			v:ChatPrint(mins.." seconds left until map change.")
46
		else
47
			v:ChatPrint(mins.." minutes left until map change.")
48
		end
49
	end
50
	timer.Simple(timeleft/2, NotifyForChange())
51-
end
51+
52
concommand.Add("mc_nextmap", function(ply)
53
	if ply:IsAdmin() then
54
		changeMap()
55
	end
56
end)