Ulysses
General => Off-Topic => Topic started by: Mass on December 15, 2006, 04:07:02 AM
-
Can anyone help me with this? How can you set up a map rotation? I want the server to automatically change maps every 60 mins but there is no map rotation that I can find anywhere
Please help
-
Mass,
Garry's mod 10 I take it?
There were a few GM9 releases that would do this. I've not searched facepunch forums lately, but know they existed.
Do you know Lua? Perhaps you could write one in Lua.
-
It is Gmod10 yes but I have absolutely no idea how to use lua to make anything. I just wasn't sure if I had missed something when creating the server but if it doesn't have this option as standard, I'll just have to wait until someone creates something
Thanks for your reply
-
local maptime = 3600
local warning = 3540
local maps = {
"gm_construct",
"gm_910",
}
local warned
local checkTime()
local players = player.GetAll()
if not warned and CurTime() > warning then
for _, player in ipairs( players ) do
player:PrintMessage( HUD_PRINTTALK, "WARNING: Map will be changed shortly!" )
end
warned = true
end
if CurTime() > maptime then
local nextmap
if table.HasValue( game.GetMap() ) then
for i, map in ipairs( maps ) do
if map == game.GetMap() then
nextmap = maps[ math.fmod( i + 1, #maps ) ]
end
end
else
nextmap = maps[ math.random( #maps ) ]
end
game.ConsoleCommand( "changelevel " .. nextmap .. "\n" )
end
end
timer.Create( "MapRotation", 60, 0, checkTime )
Just a quick untested writeup. Let me know if it doesn't work. You'll need to add whatever maps you want on the rotation into that table, and they'll go in sequence.
-
So how'd that script work for you Mass?
-
Old thread...I know. I created a script you can find it here
http://facepunch.com/showthread.php?t=978871 (http://facepunch.com/showthread.php?t=978871)