Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- =========CONFIGURATION=========
- Add whatever maps you want below in a new column like so:
- local maps={
- "gm_construct",
- "gm_flatgrass",
- "newthing",
- "anotherthing"
- }
- etc. MAKE SURE IT'S BETWEEN THE BRACKETS!!!
- ]]
- local maps={
- "gm_construct", --All but last have a comma at the end
- "gm_flatgrass" --Last doesn't have a comma
- }
- --[[
- Here is the amount of time (in minutes) between each map change.
- ]]
- local TIME_UNTIL_CHANGE=10
- -----DON'T TOUCH ANYTHING UNDER HERE-----
- local changetime=TIME_UNTIL_CHANGE*60
- hook.Add("InitPostEntity", "startMapChange", function()
- changetime=CurTime()+changetime
- timer.Simple(TIME_UNTIL_CHANGE*60, changeMap())
- end)
- function changeMap()
- local map=game.GetMap()
- local ind=(table.KeyFromValue(map) or 0)+1
- if ind and maps[ind] then
- RunConsoleCommand("changelevel", maps[ind])
- else
- RunConsoleCommand("changelevel", maps[1])
- end
- end
- function NotifyForChange()
- local timeleft=changetime-CurTime()
- local mins=math.floor(timeleft/60)
- for f, v in pairs(player.GetAll()) do
- if mins==0 then
- mins=timeleft
- v:ChatPrint(mins.." seconds left until map change.")
- else
- v:ChatPrint(mins.." minutes left until map change.")
- end
- end
- timer.Simple(timeleft/2, NotifyForChange())
- end
- concommand.Add("mc_nextmap", function(ply)
- if ply:IsAdmin() then
- changeMap()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment