Changing Maps Without Restarting Server

When I change maps in the console with


map gm_construct

for example, it kicks everyone from the server with the message “Server Shutting Down”. I have been on servers where the map changes without kicking everyone.

I am sure the answer it obvious but I can’t find it. I would like to know how to do this from LUA and from the command line (although they are probably the same).

Try


changelevel gm_construct

Dont know if it works, but its worth a try.

That will work, however he’ll need something like rcon to do it, e.g.


rcon changelevel gm_construct

Not if it’s a listen server.

Or dedicated server with access to the console.

this is from a gamemode lua so


game.ConsoleCommand("changelevel gm_construct
")

works. Is there a way to get a list of maps available with server side lua?

file.Find("…/maps/*.bsp") would give you a table of all the BSPs in your map folder.

thanks for the response, but that list’s the clients map, not the servers. Is there a built in method or do I just have to run the file.Find thing on the server then pass it to the client?

maps *

type that into the console. just maps *

it will list every map on the server, then you can use the changelevel command.

also, do not use the changelevel command when there are no users in the server. there’s simply no point.

… You need to use that code in a serverside file, then if you want the clients to have that list, use usermessages or the datastream.

well if I want to pass a Table/Array (of the maps) what do I use? I only see ones for are:


SRV umsg.Angle
SRV umsg.Bool
SRV umsg.Char
SRV umsg.End
SRV umsg.Entity
SRV umsg.Float
SRV umsg.Long
SRV umsg.PoolString
SRV umsg.Short
SRV umsg.Start
SRV umsg.String
SRV umsg.Vector
SRV umsg.VectorNormal

I recommend datastream.StreamToClients for that. You can send tables.

that is what I was thinking because I have used that before, but I just wanted to make sure I am not missing something.