import es import os import popuplib info = es.AddonInfo() info['name'] = "Maps list" info['version'] = "0.1" info['author'] = "BlahBlah" info['url'] = "Not yet" info['description'] = "Provides a menu for admins to select a map to change to" #change these to the correct steamids admins = ['STEAM_0:whatever','STEAM_0:admin'] def unload(): popuplib.delete('maps_menu') def filterfiles(file): if ".bsp" in file: return 1 return 0 def es_player_chat(event_var): if event_var['text'] == '!maps' and event_var['es_steamid'] in admins: files = os.listdir(os.path.join(os.path.normpath(es.getAddonPath('')),'..\\..\\maps')) proper_files = [] for a in files: if filterfiles(a) == 1: proper_files.append(a) menu = popuplib.easymenu('maps_menu', '_popup_choice', menu_menuselect) menu.settitle('Maps:') for c in proper_files: menu.addoption(c, c) popuplib.send('maps_menu', event_var['userid']) def menu_menuselect(caller, map, menuname): es.server.cmd("changelevel " + map.replace('.bsp',''))