def unload(): for popup in ['pistols', 'shotguns', 'smgs', 'rifles', 'snipers', 'machinegun', 'grenades', 'others', 'all', 'health', 'cash', '']: if popuplib.exists('admingive' + popup): popuplib.close('admingive' + popup, es.getUseridList()) popuplib.delete('admingive' + popup) for popup in ['targetmenu', 'giveplayermenu']: if popuplib.exists(popup): popuplib.close(popup, es.getUseridList()) popuplib.delete(popup) xaadmingive.unregister()
def unload(): for popup in ['pistols','shotguns','smgs','rifles','snipers','machinegun','grenades','item','health','cash','']: if popuplib.exists('admingive' + popup): popuplib.close('admingive' + popup, es.getUseridList()) popuplib.delete('admingive' + popup) for popup in ['targetmenu','giveplayermenu']: if popuplib.exists(popup): popuplib.close(popup, es.getUseridList()) popuplib.delete(popup) xaadmingive.unregister()
def wum_handler(userid,choice,popupname): wum_playerinfo = popuplib.create("%s%s"%(popups[1],userid)) wum_playerinfo.menuselect = wum_playerinfo_handler wum_playerinfo.addline("->1. %s"%es.getplayername(choice)) wum_playerinfo.addline("-----------------------") wum_playerinfo.addline("TLevel: %s"%es.keygetvalue("wcsuserdata",choice,"total_level")) wum_playerinfo.addline("-----------------------") race = es.keygetvalue("wcsuserdata",choice,"race") wum_playerinfo.addline("o %s : %s"%(es.keygetvalue("wcsraces",race,"name"),es.keygetvalue("wcsuserdata",choice,"level"))) numberofskills = int(es.keygetvalue("wcsraces",race,"numberofskills")) if numberofskills > 0: counter = 1 scounter = 0 skillnames = es.keygetvalue("wcsraces",race,"skillnames").split("|") while counter <= numberofskills: level = es.keygetvalue("wcsuserdata",choice,"skill_%s"%(counter)) if not level or level == 0: level = 0 wum_playerinfo.addline("- %s : %s"%(skillnames[scounter],level)) scounter += 1 counter += 1 wum_playerinfo.addline("-----------------------") skulls = 0 if es.keygetvalue("wcsuserdata",choice,"skulls"): skulls = int(es.keygetvalue("wcsuserdata",choice,"skulls")) if skulls and skulls != 0: wum_playerinfo.addline("- skulls: %s%%"%skulls) speed = 0 if es.keygetvalue("wcsuserdata",choice,"speed"): speed = float(es.keygetvalue("wcsuserdata",choice,"speed")) if speed and speed != 0: speed = int(round(speed * 100)) if speed != 100 and speed != 0: wum_playerinfo.addline("- speed: %s%%"%speed) gravity = 0 if es.keygetvalue("wcsuserdata",choice,"gravity"): gravity = float(es.keygetvalue("wcsuserdata",choice,"gravity")) if gravity and gravity > 0: gravity = int(round(gravity * 100)) if gravity != 100 and gravity != 0: wum_playerinfo.addline("- gravity: %s%%"%gravity) longjump = 0 if es.keygetvalue("wcsuserdata",choice,"longjump"): longjump = float(es.keygetvalue("wcsuserdata",choice,"longjump")) if longjump and longjump > 0: longjump = int(round(longjump * 100)) if longjump != 100 and longjump != 0: wum_playerinfo.addline("- longjump: %s%%"%longjump) invisp = 0 if es.keygetvalue("wcsuserdata",choice,"invisp"): invisp = float(es.keygetvalue("wcsuserdata",choice,"invisp")) if invisp and invisp > 0: invisp = int(round(invisp)) if invisp != 0: wum_playerinfo.addline("- invis: %s%%"%invisp) if es.getplayerprop(choice,"CCSPlayer.baseclass.pl.deadflag") == 0: wum_playerinfo.addline("- health %s%%"%es.getplayerprop(choice,"CCSPlayer.baseclass.m_iHealth")) wum_playerinfo.addline("-----------------------") wum_playerinfo.addline("->8. Back") wum_playerinfo.addline("->0. Exit") for popup in popups: if popuplib.exists("%s%s"%(popup,userid)): popuplib.close("%s%s"%(popup,userid),userid) gamethread.delayed(0.0001,wum_playerinfo.send,(userid))
def batmenu(): userid = str(es.getcmduserid()) if not superhero.hasHero(userid,'Batman'): return if popuplib.isqueued('bat_menu',userid): popuplib.close('bat_menu',userid) popuplib.send('bat_menu',userid)
def batmenu(): userid = str(es.getcmduserid()) if not superhero.hasHero(userid, 'Batman'): return if popuplib.isqueued('bat_menu', userid): popuplib.close('bat_menu', userid) popuplib.send('bat_menu', userid)
def weapon_give(userid, weapon, popupname): userid = str(userid) weapon = str(weapon) player = playerlib.getPlayer(userid) if int(player.isdead) != 1: batlist = 'tmp,mp5navy,p90,ak47,m4a1,sg552' if weapon in batlist: weapon_give = 'weapon_' + weapon primary = player.getPrimary() for x in xrange(7): handle = es.getplayerprop( userid, 'CBaseCombatCharacter.m_hMyWeapons.%03d' % x) if handle > 0: index = es.getindexfromhandle(handle) weapon = weaponlib.getWeapon( es.entitygetvalue(index, 'classname')) # Loop through all usps to find the one belonging to the player if weapon is not None and 'primary' in weapon.tags: es.entitysetvalue(index, 'targetname', 'kill_me') es.server.queuecmd('es_xfire %s kill_me kill' % userid) es.server.queuecmd('es_xgive %s %s' % (userid, weapon_give)) if popuplib.isqueued('bat_menu', userid): popuplib.close('bat_menu', userid) else: es.tell( userid, '#multi', '#green[SH] #lightgreenWeapon has already been picked once this round' )
def weapon_give(userid,weapon,popupname): userid = str(userid) weapon = str(weapon) player = playerlib.getPlayer(userid) if int(player.isdead) != 1: batlist = 'tmp,mp5navy,p90,ak47,m4a1,sg552' if weapon in batlist: weapon_give = 'weapon_'+weapon primary = player.getPrimary() for x in xrange(7): handle = es.getplayerprop(userid, 'CBaseCombatCharacter.m_hMyWeapons.%03d' % x) if handle > 0: index = es.getindexfromhandle(handle) weapon = weaponlib.getWeapon(es.entitygetvalue(index, 'classname')) # Loop through all usps to find the one belonging to the player if weapon is not None and 'primary' in weapon.tags: es.entitysetvalue(index, 'targetname', 'kill_me') es.server.queuecmd('es_xfire %s kill_me kill'%userid) es.server.queuecmd('es_xgive %s %s'%(userid, weapon_give)) if popuplib.isqueued('bat_menu', userid): popuplib.close('bat_menu', userid) else: es.tell(userid,'#multi','#green[SH] #lightgreenWeapon has already been picked once this round')
def player_spawn(ev): userid = ev['userid'] if not superhero.hasHero(userid,'Batman'): return player = playerlib.getPlayer(userid) if int(player.isdead) != 1: primary = player.getPrimary() es.tell(userid,'#multi','#green[SH]#lightgreen Batman activated. Type #greenbatmenu #lightgreento pick Weapons') if popuplib.isqueued('bat_menu',userid): popuplib.close('bat_menu',userid) if not primary: popuplib.send('bat_menu',userid)
def player_spawn(ev): userid = ev['userid'] if not superhero.hasHero(userid, 'Batman'): return player = playerlib.getPlayer(userid) if int(player.isdead) != 1: primary = player.getPrimary() es.tell( userid, '#multi', '#green[SH]#lightgreen Batman activated. Type #greenbatmenu #lightgreento pick Weapons' ) if popuplib.isqueued('bat_menu', userid): popuplib.close('bat_menu', userid) if not primary: popuplib.send('bat_menu', userid)
def pending(): for userid in es.getUseridList(): if not es.isbot(userid): status = popuplib.active(userid) if status['count'] >= 3: popuplib.close(status['name'], userid)
def consolecmd(): #Command from server console or non-python script subcmd = es.getargv(1).lower() pname = es.getargv(2) argc = es.getargc() if pname in popuplib.gPopups: p = popuplib.gPopups[pname] else: p = None debug = info if subcmd == "create": if pname: popuplib.create(pname) else: es.dbgmsg(0,"Syntax: popup create <popupname>") elif subcmd == "delete": if pname: if p: popuplib.delete(pname) else: es.dbgmsg(0,"Popup delete: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup delete <popupname>") elif subcmd == "addline": if argc == 4: if p: text = str(es.getargv(3)) p.addline(text) else: es.dbgmsg(0,"Popup addline: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup addline <popupname> <text>") elif subcmd == "delline": if argc == 4: if p: line = int(es.getargv(3)) p.delline(line) else: es.dbgmsg(0,"Popup delline: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup delline <popupname> <line#>") elif subcmd == "insline": if argc == 5: if p: line = int(es.getargv(3)) text = str(es.getargv(4)) p.insline(line, text) else: es.dbgmsg(0,"Popup insline: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup insline <popupname> <line#> <text>") elif subcmd == "modline": if argc == 5: if p: line = int(es.getargv(3)) text = str(es.getargv(4)) p.modline(line, text) else: es.dbgmsg(0,"Popup modline: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup modline <popupname> <line#> <text>") elif subcmd == "prepuser": if argc == 4: if p: block = str(es.getargv(3)) if block == "0": block = "" p.prepuser = block else: es.dbgmsg(0,"Popup prepuser: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup prepuser <popupname> <block>") elif subcmd == "menuselect": if argc == 4: if p: block = es.getargv(3) if block == "0": block = "" p.menuselect = block else: es.dbgmsg(0,"Popup menuselect: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup menuselect <popupname> <block>") elif subcmd == "menuselectfb": if argc == 4: if p: block = es.getargv(3) if block == "0": block = "" p.menuselectfb = block else: es.dbgmsg(0,"Popup menuselectfb: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup menuselectfb <popupname> <block>") elif subcmd == "select": if argc == 5: if p: item = int(es.getargv(3)) block = es.getargv(4) if block == "0": block = "" p.select(item, block) else: es.dbgmsg(0,"Popup select: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup select <popupname> <choice#> <block>") elif subcmd == "submenu": if argc == 5: if p: item = int(es.getargv(3)) block = es.getargv(4) if block == "0": block = "" p.submenu(item, block) else: es.dbgmsg(0,"Popup submenu: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup submenu <popupname> <choice#> <submenu>") elif subcmd == "menuvalue": if argc == 6: if p: item = int(es.getargv(4)) varn = es.getargv(3) varv = es.getargv(5) p.menuvalue(varn, item, varv) else: es.dbgmsg(0,"Popup menuvalue: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup menuvalue <popupname> <variable> <choice#> <value>") elif subcmd == "timeout": if argc == 5: if p: tomode = es.getargv(3) time = float(es.getargv(4)) p.timeout(tomode, time) else: es.dbgmsg(0,"Popup timeout: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup timeout <popupname> <mode> <time>") es.dbgmsg(0," mode: \"send\" or \"view\"") elif subcmd == "send": if argc == 5: try: prio = bool(int(es.getargv(4))) except ValueError: prio = False else: prio = False if argc >= 4: if p: users = es.getargv(3) p.send(playerlib.getUseridList(users),prio) else: es.dbgmsg(0,"Popup send:No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup send <popupname> <users>") elif subcmd == "unsendname": if argc == 4: if p: users = es.getargv(3) popuplib.unsendname(pname, playerlib.getUseridList(users)) else: es.dbgmsg(0,"Popup unsendname: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup unsendname <popupname> <users>") elif subcmd == "close": if argc == 4: if p: users = es.getargv(3) popuplib.close(pname, playerlib.getUseridList(users)) else: es.dbgmsg(0,"Popup close: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup close <popupname> <users>") elif subcmd == "isqueued": if argc == 5: if p: retvar = es.getargv(3) userid = int(es.getargv(4)) es.set(retvar,popuplib.isqueued(pname,userid)) else: es.dbgmsg(0,"Popup isqueued: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup isqueued <popupname> <var> <userid>") elif subcmd == "active": if argc == 5: retvar = es.getargv(3) userid = int(es.getargv(4)) try: r = popuplib.active(userid) es.set(pname,r['name']) es.set(retvar,r['count']) except KeyError: es.dbgmsg(0,"Popup active: No userid "+str(userid)+" on server.") else: es.dbgmsg(0,"Syntax: popup active <name var> <count var> <userid>") elif subcmd == "exists": if argc == 4: retvar = es.getargv(3) es.set(retvar,int(popuplib.exists(pname))) else: es.dbgmsg(0,"Syntax: popup exists <popupname> <var>") elif subcmd == "addlinef": if argc > 3: if p: text = _formatv(3) p.addline(text) else: es.dbgmsg(0,"Popup addlinef: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup addlinef <popupname> <format> [vartoken1] ... [vartoken9]") elif subcmd == "inslinef": if argc > 4: if p: line = int(es.getargv(3)) text = _formatv(4) p.insline(line,text) else: es.dbgmsg(0,"Popup inslinef: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup inslinef <popupname> <line#> <format> [vartoken1] ... [vartoken9]") elif subcmd == "modlinef": if argc > 4: if p: line = int(es.getargv(3)) text = _formatv(4) p.modline(line,text) else: es.dbgmsg(0,"Popup modlinef: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup modlinef <popupname> <line#> <format> [vartoken1] ... [vartoken9]") elif subcmd == "cachemode": if argc == 4: if p: tomode = es.getargv(3) p.cachemode = tomode else: es.dbgmsg(0,"Popup cachemode: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup cachemode <popupname> <mode>") es.dbgmsg(0," mode: \"global\", \"static\" or \"user\"") elif subcmd == "recache": if argc > 2: if p: if argc == 4: users = playerlib.getUseridList(es.getargv(3)) p.recache(users) else: p.recache() else: es.dbgmsg(0,"Popup recache: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup recache <popupname> [users]") elif subcmd == "update": if argc == 4: if p: users = playerlib.getUseridList(es.getargv(3)) p.update(users) else: es.dbgmsg(0,"Popup update: No such popup: "+pname) else: es.dbgsmg(0,"Syntax: popup update <popupname> <users>") elif subcmd == "displaymode": if argc == 4: if p: tomode = es.getargv(3) p.displaymode = tomode else: es.dbgmsg(0,"Popup displaymode: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup displaymode <popupname> <mode>") es.dbgmsg(0," mode: \"normal\" or \"sticky\"") elif subcmd == "construct": if argc == 6: varp = es.getargv(5) else: varp = "_popup_choice" if argc >= 5: plist = es.getargv(3) pflags = es.getargv(4) nep = popuplib.construct(pname,plist,pflags) nep.c_savevar = varp else: es.dbgmsg(0,"Syntax: popup construct <popupname> <list> <flags> [var]") elif subcmd == "setvar": if argc == 5: if p: ok = False varp = es.getargv(3) if varp.isalnum(): ok = True else: if varp[:2] == "c_" and varp[2:].isalnum(): ok = True varv = es.getargv(4) if ok: p.__setattr__(varp,varv) else: es.dbgmsg(0,"Invalid popup variable name") else: es.dbgmsg(0,"Popup setvar: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup setvar <popupname> <variable> <value>") elif subcmd == "getvar": if argc == 5: if p: ok = False varp = es.getargv(3) varv = es.getargv(4) if varv.isalnum(): ok = True else: if varv[:2] == "c_" and varv[2:].isalnum(): ok = True if ok: es.set(varp, p.__getattr__(varv)) else: es.dbgmsg(0,"Invalid popup variable name") else: es.dbgmsg(0,"Popup getvar: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup getvar <popupname> <var> <variable>") elif subcmd == "easymenu": if argc == 5: varp = es.getargv(3) block = es.getargv(4) popuplib.easymenu(pname,varp,block) else: es.dbgmsg(0,"Syntax: popup easymenu <popupname> <var> <block>") elif subcmd == "addoption": if argc > 4: if p: item = str(es.getargv(3)) text = str(es.getargv(4)) if argc == 6: state = int(es.getargv(5)) else: state = 1 p.addoption(item, text, state) else: es.dbgmsg(0,"Easymenu addoption: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup addoption <popupname> <value> <text> [state]") elif subcmd == "setoption": if argc > 3: if p: item = int(es.getargv(3)) if argc == 5: text = es.getargv(4) if int(text) > 0 and int(text) <= 2 or str(text) == '0': p.setoption(item,None,int(text)) else: p.setoption(item,text,None) elif argc == 6: text = es.getargv(4) state = int(es.getargv(5)) p.setoption(item,text,state) else: es.dbgmsg(0,"Easymenu setoption: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup setoption <popupname> <item> [text] [state]") elif subcmd == "description": if argc == 4: if p: text = es.getargv(3) p.setdescription(text) else: es.dbgmsg(0,"Popup description: No such popup: "+pname) else: es.dbgmsg(0,"Usage: popup description <popupname> <text>") elif subcmd == "info": if argc >= 3: if argc == 4: listlevel = int(es.getargv(3)) else: listlevel = 4 if p: p.information(listlevel) else: es.dbgmsg(0, "Syntax: popup info <popupname> [level]") elif subcmd == "emulate": if argc == 5: if p: item = int(es.getargv(3)) users = es.getargv(4) popuplib.emulate(pname,item,users) else: es.dbgmsg(0,"Popup emulate: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup emulate <popupname> <choice#> <users>") elif subcmd == "editlang": if argc == 4: if p: p.editlang = str(es.getargv(3)) else: es.dbgmsg(0,"Popup editlang: No such popup: "+pname) else: es.dbgmsg(0,"Syntax: popup editlang <popupname> <language>") elif subcmd == "setstyle": if argc >= 3: style = es.getargv(argc-1) passvalue = 0 if style.startswith("radio"): passvalue |= 1 if style.startswith("esc"): passvalue |= 2 if style.endswith("!"): passvalue |= 128 if argc == 4: if p: p.visualstyle = passvalue else: es.dbgmsg(0,"Popup setstyle: No such popup: "+pname) else: popuplib.gameSupportAdmin = passvalue else: es.dbgmsg(0,"Syntax: popup setstyle [popupname] {auto|radio|esc}[!]") elif subcmd == "quicksend": if argc == 6: block = str(es.getargv(5)) else: block = "" if argc > 4: time = float(es.getargv(2)) userid = float(es.getargv(3)) text = str(es.getargv(4)) popuplib.quicksend(time,userid,text,block) else: es.dbgmsg(0,"Syntax: popup quicksend <time> <userid> <text> [block]") elif subcmd == "list": es.dbgmsg(0,"---------- List of popups:") if argc == 2: listlevel = 0 else: listlevel = int(pname) for pname in popuplib.gPopups: p = popuplib.gPopups[pname] p.information(listlevel) if argc == 2: es.dbgmsg(0, " ") es.dbgmsg(0, "For more details, supply list level (0-4):") es.dbgmsg(0, "Syntax: popup list [level]") es.dbgmsg(0,"----------") else: es.dbgmsg(0,"Invalid popup subcommand, see http://www.eventscripts.com/pages/Popup/ for help")
def adminPopupMenuselect(userid, choice, popupid): """ Handles the menu select from the admin menu. Note: You have to staticly cast the getplayerlocation to a list so we can edit the items in it as getplayerlocation returns a tuple which can't be edited. """ mapName = str(currentMap) if choice == 1: if mapName not in mapDicts: mapDicts[mapName] = {} if "startpos" not in mapDicts[mapName]: mapDicts[mapName]['startpos'] = [ (0,0,0), (0,0,0) ] if userid not in effects: effects.append(userid) tell(userid, 'added start one') start = list(es.getplayerlocation(userid)) start[2] -= 5 mapDicts[mapName]["startpos"][0] = start effectLoop(userid, start) else: effects.remove(userid) gamethread.cancelDelayed('surftimer_effects') tell(userid, 'added start two') mapDicts[mapName]["startpos"][1] = list(es.getplayerlocation(userid)) mapDicts[mapName]["startpos"][1][2] -= 5 if "endpos" in mapDicts[mapName]: gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) hudLoop() adminPopup.send(userid) elif choice == 2: if mapName not in mapDicts: mapDicts[mapName] = {} if "endpos" not in mapDicts[mapName]: mapDicts[mapName]['endpos'] = [ (0,0,0), (0,0,0) ] if userid not in effects: effects.append(userid) tell(userid, 'added end one') start = list(es.getplayerlocation(userid)) start[2] -= 5 mapDicts[mapName]["endpos"][0] = start effectLoop(userid, start, 255, 0) else: effects.remove(userid) gamethread.cancelDelayed('surftimer_effects') tell(userid, 'added end two') mapDicts[mapName]["endpos"][1] = list(es.getplayerlocation(userid)) mapDicts[mapName]["endpos"][1][2] -= 5 if "startpos" in mapDicts[mapName]: gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) hudLoop() adminPopup.send(userid) elif choice == 3: if mapName in mapDicts: del mapDicts[mapName] gamethread.cancelDelayed('surftime_checkloop') tell(userid, 'delete') elif choice == 4: if mapName in mapDicts: popuplib.close("surftimer_admin", userid) global playerList playerList = popuplib.easymenu("surftimer_playerlist", None, playerPopupMenuselect) playerList.settitle("[Surf Timer DB : %s]" % mapName) sortedList = mk_sortDict(mapName) if sortedList: lx = 1 for top in sortedList: playerList.addoption('%s' % str(top[0]), "Rank " + str(lx) + ": " + mapDicts[mapName][top[0]]["name"] + " " + formatTime(mapDicts[mapName][top[0]]["time"])) lx += 1 else: playerList.setdescription("[No places recorded]") playerList.send(userid) else: tell(userid, 'no map records', {})
def adminPopupMenuselect(userid, choice, popupid): """ Handles the menu select from the admin menu. Note: You have to staticly cast the getplayerlocation to a list so we can edit the items in it as getplayerlocation returns a tuple which can't be edited. """ mapName = str(currentMap) if choice == 1: if mapName not in mapDicts: mapDicts[mapName] = {} if "startpos" not in mapDicts[mapName]: mapDicts[mapName]['startpos'] = [(0, 0, 0), (0, 0, 0)] if userid not in effects: effects.append(userid) tell(userid, 'added start one') start = list(es.getplayerlocation(userid)) start[2] -= 5 mapDicts[mapName]["startpos"][0] = start effectLoop(userid, start) else: effects.remove(userid) gamethread.cancelDelayed('surftimer_effects') tell(userid, 'added start two') mapDicts[mapName]["startpos"][1] = list( es.getplayerlocation(userid)) mapDicts[mapName]["startpos"][1][2] -= 5 if "endpos" in mapDicts[mapName]: gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) hudLoop() adminPopup.send(userid) elif choice == 2: if mapName not in mapDicts: mapDicts[mapName] = {} if "endpos" not in mapDicts[mapName]: mapDicts[mapName]['endpos'] = [(0, 0, 0), (0, 0, 0)] if userid not in effects: effects.append(userid) tell(userid, 'added end one') start = list(es.getplayerlocation(userid)) start[2] -= 5 mapDicts[mapName]["endpos"][0] = start effectLoop(userid, start, 255, 0) else: effects.remove(userid) gamethread.cancelDelayed('surftimer_effects') tell(userid, 'added end two') mapDicts[mapName]["endpos"][1] = list(es.getplayerlocation(userid)) mapDicts[mapName]["endpos"][1][2] -= 5 if "startpos" in mapDicts[mapName]: gamethread.delayedname(0.1, 'surftime_checkloop', checkLoop) hudLoop() adminPopup.send(userid) elif choice == 3: if mapName in mapDicts: del mapDicts[mapName] gamethread.cancelDelayed('surftime_checkloop') tell(userid, 'delete') elif choice == 4: if mapName in mapDicts: popuplib.close("surftimer_admin", userid) global playerList playerList = popuplib.easymenu("surftimer_playerlist", None, playerPopupMenuselect) playerList.settitle("[Surf Timer DB : %s]" % mapName) sortedList = mk_sortDict(mapName) if sortedList: lx = 1 for top in sortedList: playerList.addoption( '%s' % str(top[0]), "Rank " + str(lx) + ": " + mapDicts[mapName][top[0]]["name"] + " " + formatTime(mapDicts[mapName][top[0]]["time"])) lx += 1 else: playerList.setdescription("[No places recorded]") playerList.send(userid) else: tell(userid, 'no map records', {})