• Automatic Map Reload
    3 replies, posted
Hello, I'm looking for something that will automatically reload the map that its on every 3 1/2 hours, also it will alert the players every 30 minutes, thanks!
What do you mean reload it? Like, have the server change map to the same or what? Delete some entities?
Put this in a file in garrysmod/lua/autorun/server, on the server. [lua] function AutoRestartMap() halfhourspassed = 0 HalfHourPlus() end hook.Add( "Initalize", "AutoRestartMap", AutoRestartMap ) function HalfHourPlus() timer.Simple( 1800, function() halfhourspassed = halfhourspassed + 1 timetillrestart = 210 - ( halfhourspassed * 30 ) for k, v in pairs(player.GetAll()) do v:ChatPrint( "The map will auto-restart in "..timetillrestart.." minutes." ) end if halfhourspassed == 7 then for k, v in pairs(player.GetAll()) do v:ChatPrint( "The map will restart in one minute!" ) end timer.Simple( 60, function() RunConsoleCommand( "changelevel", game.GetMap() ) end end HalfHourPlus() end) end [/lua]
The Chat printing doesn't work.
Sorry, you need to Log In to post a reply to this thread.