GM:Initialize( )

[lua]
function City18()
if game.GetMap() == “gm_construct” then
game.ConsoleCommand( “changelevel rp_c18_v1” )
end
end
hook.Add( “Initialize”, “City18”, City18 )
[/lua]

Think it would work?

Looks correct here. Why make a thread if you didn’t test it first if it works or not?

Because it’s not working.

[lua]
function GM:Initialize( ) – Initialize the gamemode
if game.GetMap() == “gm_construct” then
game.ConsoleCommand( “changelevel rp_c18_v1” )
end
end
[/lua]

From the wiki:

So this should work:
[lua]
function GM:Initialize( ) – Initialize the gamemode
if game.GetMap() == “gm_construct” then
game.ConsoleCommand( "changelevel rp_c18_v1
" )
end
end
[/lua]

Doesn’t work.

-snip-

Weird. You would think any of them would work. Can’t figure out why.

What exactly is GetMap returning? Print the value it returns, as it could be returning it with the bsp extension.

Try InitPostEntity?

I’m trying to get the current map. If the map is construct then change map to rp_c18_v1.

Forgive me if I don’t see a point to this, but why not just set the default map to be city18 in the command line?

This.

This.

This.

That.

This won’t work because you forgot a space after changelevel.

It’s basically running the consolecommand,
changelevelrp_c18v1.

The server provider is a dick and doesn’t offer it.

game.ConsoleCommand blocks changelevel for some reason I think. Try hacking your way through it.

[lua]
function City18()
if game.GetMap() == “gm_construct” then
RunConsoleCommand( “changelevel”, “rp_c18_v1” )
end
end
hook.Add( “Initialize”, “City18”, City18 )
[/lua]
^ Should work ^

No that will not work…
this will:

[lua]
function City18()
if game.GetMap() == “gm_construct” then
RunConsoleCommand( "changelevel ", “rp_c18_v1” )
end
end
hook.Add( “Initialize”, “City18”, City18 )
[/lua]

you need a space after changelevel otherwise its running changelevelrp_c18_v1 instead of changelevel rp_c18_v1