Hi,
is there a variable provided to find out the current map on the server or is that on the todo list?
Find out current map
satoon101 wrote:We have discussed including events and variables with SP. A map start event will probably be getting added at some point. If host_map works, we will not have a need to include a current map variable. If not, that is a possible variable that could be added.
Satoon
Alright thanks. host_map would be cool, can't test it now though.
host_map does indeed hold the current map name, this includes ".bsp"
does anyone know if it's possible to pipe the value of one cvar into a console command?
Say I wanted to change the map to the current map (don't ask why)... I would want...
changelevel host_map
or
map host_map
any clue if this is possible to do?
does anyone know if it's possible to pipe the value of one cvar into a console command?
Say I wanted to change the map to the current map (don't ask why)... I would want...
changelevel host_map
or
map host_map
any clue if this is possible to do?
I'm pretty sure that this will work:
Syntax: Select all
from Source.Engine import GetEngine
from Source.Cvar import GetCvar
engine = GetEngine()
cvar = GetCvar()
def getCurrentMap():
current_map = cvar.FindVar('host_map').GetString()
return '' if not current_map else current_map.rsplit('.bsp', 1)[0]
def player_say(game_event):
current_map = getCurrentMap()
engine.ChangeLevel(current_map, None)
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 139 guests