def __init__(self, userid, weaponslist): if playerlib.getPlayer(userid).isbot: es.give(userid, "weapon_" + weaponslist[0]) return None if len(weaponslist) == 1: es.give(userid, "weapon_" + weaponslist[0]) return None self.userid = userid self.weaponslist = weaponslist menuid = random.randint(0, 1000) if es.exists("popup", "ultilib_weaponmenu%d" % menuid): popuplib.delete("ultilib_weaponmenu%d" % menuid) weaponMenu = popuplib.create("ultilib_weaponmenu%d" % menuid) weaponMenu.addline("Choose a weapon:") weaponMenu.addline(" ") if len(self.weaponslist) < 9: for i in range(0, len(self.weaponslist)): weaponMenu.addline("->%d. %s" % (i + 1, self.weaponslist[i])) else: for i in range(0, 9): weaponMenu.addline("->%d. %s" % (i + 1, self.weaponslist[i])) weaponMenu.addline(" ") weaponMenu.addline("0. Cancel") weaponMenu.menuselect = self.select popuplib.send("ultilib_weaponmenu%d" % menuid, userid)
def genRaceinfoPop(popupname, callback, userid, race): checkPop(popupname) raceinfop = popuplib.create("raceinfo_menu_%s" % userid) raceinfop.menuselect = raceinfo_handler raceinfop.addline("->%s. %s (%s levels/%s skills)" % (race, es.keygetvalue("wcsraces", race, "name"), es.keygetvalue("wcsraces", race, "numberoflevels"), es.keygetvalue("wcsraces", race, "numberofskills"))) raceinfop.addline("Credits: %s" % es.keygetvalue("wcsraces", race, "author")) raceinfop.addline("------------------------") numofskills = int(es.keygetvalue("wcsraces", race, "numberofskills")) counter = 1 scounter = 0 skillnames = es.keygetvalue("wcsraces", race, "skillnames").split("|") skilldescr = es.keygetvalue("wcsraces", race, "skilldescr").split("|") while (counter <= numofskills): raceinfop.addline("->%s. %s" % (counter, skillnames[scounter])) raceinfop.addline("%s" % skilldescr[scounter]) scounter += 1 counter += 1 raceinfop.addline("------------------------") raceinfop.addline("->8. Back") raceinfop.addline("->9. Next") gamethread.delayed(0.0001, raceinfop.send, (userid)) es.keysetvalue("wcsuserdata", userid, "raceinfo", race)
def cp_menu(userid): steamid = es.getplayersteamid(userid) timer = es.import_addon("queue_timer/plugins/timer") QueueAPI.Validate(userid, 0) info = popuplib.create('checkpoint_menu') info.addline('Checkpoints') info.addline(' ') info.addline('->1. Save CP 1') info.addline('->2. Teleport to CP 1 ') info.addline(' ') info.addline('->3. Save CP 2') info.addline('->4. Teleport to CP 2') info.addline(' ') if client[steamid]["stop_speed"] == "On": info.addline('->5. Save speed: On') else: info.addline('->5. Save speed: Off') if client[steamid]["save_angles"] == "On": info.addline('->6. Save angles: On') else: info.addline('->6. Save angles: Off') info.addline(' ') if timer.CheckPartner(userid): info.addline('Disabled during timer!') info.addline(' ') info.addline('->8. Back') info.addline('0 Exit') info.enablekeys = "12345608" info.unsend(userid) info.send(userid) info.delete() info.menuselect = cp_menu_select
def chosenPlayer(self, userid, choice, popupid): """ This method builds a menu about a certain player. It will detail the simple attributes of the player then sets out certain commands we can execute regarding the user. Finally send the menu @PARAM userid - the id of the user we will send the menu to @PARAM choice - the steamid of the user the popup will represent @PARAM popupid - the name of the popup which was used to access this method """ details = self.getDetails(choice) playerMenu = popuplib.create("sourcerpg_player%s" % choice) playerMenu.addline("=== %s Admin (%s) ===" % (sourcerpg.prefix, details['name'])) playerMenu.addline("-" * 30) playerMenu.addline("Status: %s" % {True: "Online", False: "Offline"}[self.isOnline(choice)]) playerMenu.addline("Level: %s" % details['level']) playerMenu.addline("XP: %s/%s" % (details['xp'], details['level'] * int(sourcerpg.xpIncrement) + int(sourcerpg.startXp))) playerMenu.addline(" ") playerMenu.addline("->1. Give Experience") playerMenu.addline("->2. Give Levels") playerMenu.addline("->3. Give Credits") playerMenu.addline("->4. Upgrade a skill") playerMenu.addline("->5. Downgrade a skill") playerMenu.addline("->6. Max all skills") playerMenu.addline(" ") playerMenu.addline("->8. Reset Skills") playerMenu.addline("-" * 30) playerMenu.addline("0. Back") playerMenu.menuselectfb = self.executePlayerOption playerMenu.submenu(10, popupid) playerMenu.send(userid)
def playerinfo_list_selection(userid,choice,popup): steamid = getID(choice.userid) pheroes = cursor.execute('SELECT heroes FROM users WHERE id=?', (steamid,)).fetchone() if pheroes: id = choice.userid playerinfo = popuplib.create('playerinfo') playerinfo.addline('-> 1.'+str(es.getplayername(id))) playerinfo.addline('---------') heroes = [] heroes = list(pheroes) heroes = heroes[0].split(',') counter = 0 for hero in heroes: hero = str(hero) if hero != '0': counter += 1 playerinfo.addline(str(counter)+' - '+hero) if counter == 0: playerinfo_popup = langlib.Strings(es.getAddonPath("superhero") + "/languages/playerinfo_popup.ini") global popup_language playerinfo.addline(playerinfo_popup('playerinfo_noheroes',lang=str(popup_language))) playerinfo.addline('---------') playerinfo.addline('-> 2.Back') playerinfo.menuselect = playerinfo_selection #close_popups(userid) popuplib.send('playerinfo',userid)
def load(): es.dbgmsg(0, "[SH] Loading.....") es.doblock('corelib/noisy_on') config.execute() # Executes the .cfg to register changes global popup_language popup_language = es.ServerVar('popup_language') global rounds_played rounds_played = 0 es.server.queuecmd('es_xload superhero/heroes') es.server.queuecmd('es_xload superhero/admins') # Create a group global heroes heroes = [] ### Get the Strings the popup cmdlist_popup = langlib.Strings(es.getAddonPath("superhero") + "/languages/cmdlist_popup.ini") # Create popups global commandlist commandlist = popuplib.easymenu('commandlist','choice',commandlist_selection) commandlist.settitle('All Commands') commandlist.addoption('help',cmdlist_popup('cmd_help',lang=str(popup_language))) # Done commandlist.addoption('herolist',cmdlist_popup('cmd_herolist',lang=str(popup_language))) # Done commandlist.addoption('playerinfo',cmdlist_popup('cmd_playerinfo',lang=str(popup_language))) commandlist.addoption('myheroes',cmdlist_popup('cmd_myheroes',lang=str(popup_language))) # Done commandlist.addoption('clearpowers',cmdlist_popup('cmd_clearpowers',lang=str(popup_language))) # Done commandlist.addoption('showmenu',cmdlist_popup('cmd_showmenu',lang=str(popup_language))) # Done commandlist.addoption('showxp',cmdlist_popup('cmd_showxp',lang=str(popup_language))) # Done commandlist.addoption(None,cmdlist_popup('cmd_drop',lang=str(popup_language))) # Done commandlist.addoption(None,cmdlist_popup('cmd_buyxp',lang=str(popup_language))) commandlist.addoption(None,cmdlist_popup('cmd_binding',lang=str(popup_language))) helpbox_popup = langlib.Strings(es.getAddonPath("superhero") + "/languages/helpbox_popup.ini") global helpbox helpbox = popuplib.create('helpbox') helpbox.addline(helpbox_popup('helpbox_1',lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_2',lang=str(popup_language))) helpbox.addline('\n\n') helpbox.addline(helpbox_popup('helpbox_3',lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_4',lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_5',lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_6',lang=str(popup_language))) # Saycommands register etc. cmdlib.registerSayCommand('/commandlist', 'superhero/commandlist', 'COMMANDLIST') cmdlib.registerSayCommand('/shmenu', 'superhero/commandlist', 'SHMENU') cmdlib.registerSayCommand('/sh', 'superhero/commandlist', 'SH') cmdlib.registerSayCommand('/help', superherohelp, 'HELP') cmdlib.registerSayCommand('/showmenu', showmenu, 'SHOWMENU') cmdlib.registerSayCommand('/drop', drop, 'DROP') cmdlib.registerSayCommand('/showxp', showxp, 'SHOWXP') cmdlib.registerSayCommand('/myheroes', myheroes, 'MYHEROES') cmdlib.registerSayCommand('hashero', 'superhero/hashero', 'HASHERO') cmdlib.registerSayCommand('/buyxp', buyxp, 'BUYXP') cmdlib.registerSayCommand('/herolist', herolist, 'HEROLIST') cmdlib.registerSayCommand('/clearpowers', clearpowers, 'CLEARPOWERS') cmdlib.registerSayCommand('/playerinfo', playerinfo, 'PLAYERINFO') cmdlib.registerClientCommand('+power1', power, "+power1") cmdlib.registerClientCommand('-power1', poweroff, "-power1") cmdlib.registerClientCommand('+power2', power, "+power2") cmdlib.registerClientCommand('-power2', poweroff, "-power2") cmdlib.registerClientCommand('+power3', power, "+power3") cmdlib.registerClientCommand('-power3', poweroff, "-power3") es.dbgmsg(0, "[SH] Loading Done.")
def trikz_menu(userid, text=None, steamid=None, name=None): QueueAPI.Validate(userid, 0) steamid = es.getplayersteamid(userid) info = popuplib.create('trikz_menu') info.addline('[ DreamAboutNow ]') info.addline(' ') if client[steamid]["auto_switch"] == "On": info.addline('->1. Auto Switch: On') else: info.addline('->1. Auto Switch: Off') if client[steamid]["auto_jump"] == "On": info.addline('->2. Auto Jump: On') else: info.addline('->2. Auto Jump: Off') if client[steamid]["auto_stuck"] == "On": info.addline('->3. Anti Stuck: On') else: info.addline('->3. Anti Stuck: Off') if client[steamid]["player_state"] == "Ghost": info.addline('->4. Blocking: Off') else: info.addline('->4. Blocking: On') info.addline(' ') info.addline('->5. Checkpoints') info.addline(' ') info.addline('0. Exit') info.enablekeys = "12345680" info.unsend(userid) info.send(userid) info.delete() info.menuselect = trikz_menu_select
def playerinfo_list_selection(userid, choice, popup): steamid = getID(choice.userid) pheroes = cursor.execute('SELECT heroes FROM users WHERE id=?', (steamid, )).fetchone() if pheroes: id = choice.userid playerinfo = popuplib.create('playerinfo') playerinfo.addline('-> 1.' + str(es.getplayername(id))) playerinfo.addline('---------') heroes = [] heroes = list(pheroes) heroes = heroes[0].split(',') counter = 0 for hero in heroes: hero = str(hero) if hero != '0': counter += 1 playerinfo.addline(str(counter) + ' - ' + hero) if counter == 0: playerinfo_popup = langlib.Strings( es.getAddonPath("superhero") + "/languages/playerinfo_popup.ini") global popup_language playerinfo.addline( playerinfo_popup('playerinfo_noheroes', lang=str(popup_language))) playerinfo.addline('---------') playerinfo.addline('-> 2.Back') playerinfo.menuselect = playerinfo_selection #close_popups(userid) popuplib.send('playerinfo', userid)
def leader_menu_cmd(userid, args): global leaderList # Make sure player exists if not es.exists('userid', userid) and userid != 0: return # Get menu contents newLeaderList = ['->1. Current Leaders:'] leaderNames = get_leader_names() # Add names if we have leaders if leaderNames: # Add leader level and weapon leaderLevel = get_leader_level() newLeaderList.append(' Level %s (%s)' % (leaderLevel, get_level_weapon(leaderLevel))) # Divider newLeaderList.append('-' * 26) # Add player names for player_name in leaderNames: newLeaderList.append(' * %s' % player_name) # No leader else: newLeaderList.extend(('-' * 26, ' * There currently is no leader')) # Finish popup with divider and exit newLeaderList.extend(('-' * 26, '0. Exit')) # Does the popup exists ? if popuplib.exists('ggLeaderMenu'): # Send the user the current popup ? if newLeaderList == leaderList: popuplib.send('ggLeaderMenu', userid) return # Delete the popup popuplib.unsendname('ggLeaderMenu', getUseridList('#human')) popuplib.delete('ggLeaderMenu') # Build new popup ggLeaderMenu = popuplib.create('ggLeaderMenu') ggLeaderMenu.timeout('send', 10) ggLeaderMenu.timeout('view', 10) # Add lines to new popup for line in newLeaderList: ggLeaderMenu.addline(line) # Save current popup leaderList = newLeaderList # Send it popuplib.send('ggLeaderMenu', userid)
def mystats_menu(userid): global raw steamid = es.getplayersteamid(userid) myPopup = popuplib.create('stat_popup') myPopup.addline("Your Stats") myPopup.addline(' ') myPopup.addline(" points: %s" % getValue(steamid, 'points', 0)) myPopup.addline(' ') myPopup.addline('->0 Close') myPopup.send(userid)
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 ChangeMapBuild(function, userid): mypopup = popuplib.create("mapchange") a = mypopup.addline a('When should the map change?') a('-------------------------------') a('->1. Immediately') a('->2. End of the round') a('->3. End of the map') a('-------------------------------') a('0. Cancel') mypopup.menuselect = function mypopup.send(userid)
def stats_select(userid, choice, popupid): myPopup = popuplib.create('stat_popup') myPopup.addline(choice) myPopup.addline(" " * 80) #time.asctime( time.localtime( float(v) ) ) #myPopup.addline(" %s: %s" % (k,v)) # Broken #myPopup.addline("Times completed: %s" % getValue(choice, 'total_completed', 1)) #myPopup.addline(" ") # First myPopup.addline("First Person:") myPopup.addline(" %s" % getValue(choice, 'first_player_name')) myPopup.addline(" %s" % epochtime(getValue(choice, 'first_player_time'))) myPopup.addline(" ") # Speed myPopup.addline("Fastest Person (Speed):") myPopup.addline(" %s" % getValue(choice, 'fastest_speed_name')) myPopup.addline(" %.4f mph" % float(getValue(choice, 'fastest_speed_mph'))) myPopup.addline(" %s" % epochtime(getValue(choice, 'fastest_speed_date'))) myPopup.addline(" ") myPopup.addline("Slowest Person (Speed):") myPopup.addline(" %s" % getValue(choice, 'slowest_speed_name')) myPopup.addline(" %.4f mph" % float(getValue(choice, 'slowest_speed_mph'))) myPopup.addline(" %s" % epochtime(getValue(choice, 'slowest_speed_date'))) myPopup.addline(" ") # Time myPopup.addline("Fastest Person (Time):") myPopup.addline(" %s" % getValue(choice, 'fastest_time_name')) myPopup.addline(" %.4f" % float(getValue(choice, 'fastest_time_time'))) myPopup.addline(" %s" % epochtime(getValue(choice, 'fastest_time_date'))) myPopup.addline(" ") myPopup.addline("Slowest Person (Time):") myPopup.addline(" %s" % getValue(choice, 'slowest_time_name')) myPopup.addline(" %.4f" % float(getValue(choice, 'slowest_time_time'))) myPopup.addline(" %s" % epochtime(getValue(choice, 'slowest_time_date'))) myPopup.addline(" ") #myPopup.addline(" %s: %s" % (k,v)) myPopup.addline('->9 Back') myPopup.addline('->0 Close') myPopup.menuselect = stats_select_func myPopup.send(userid)
def _variableEditMenu(userid, module, variable, parent): if str(module) != 'core': descr = str(variable._descr) if len(descr) > 100: descr = descr[0:50] + '\n' + descr[50:50] + '\n' + descr[100:50] elif len(descr) > 50: descr = descr[0:50] + '\n' + descr[50:50] changesetting = popuplib.create('xachangesettingmenu_' + str(random.randint(1, 10)) + '_' + str(userid) + '_' + variable.getName()) changesetting.addline(lang('change setting')) changesetting.addlineAll('Name: ' + variable.getName()) changesetting.addlineAll('Value: ' + str(variable)) if str(module) != 'core': changesetting.addlineAll(descr) changesetting.addlineAll(' ') changesetting.addline(lang('variable warning')) changesetting.addlineAll('------------------------------------') changesetting.addline(popuplib.langstring('->1. ', lang['type value'])) changesetting.addline(popuplib.langstring('->2. ', lang['default value'])) changesetting.addlineAll('------------------------------------') if str(variable).isdigit(): changesetting.addlineAll('->3. +1') changesetting.addlineAll('->4. -1') changesetting.addlineAll('->5. +10') changesetting.addlineAll('->6. -10') changesetting.addlineAll('->7. +100') changesetting.addlineAll('->8. -100') changesetting.addlineAll('------------------------------------') changesetting._xatype = 'int' elif str(variable).replace('.', '').isdigit(): changesetting.addlineAll('->3. +0.1') changesetting.addlineAll('->4. -0.1') changesetting.addlineAll('->5. +1.0') changesetting.addlineAll('->6. -1.0') changesetting.addlineAll('->7. +10.0') changesetting.addlineAll('->8. -10.0') changesetting.addlineAll('------------------------------------') changesetting._xatype = 'float' else: changesetting._xatype = 'str' if str(module) != 'core': changesetting.addline(popuplib.langstring('->9. ', lang['save back'])) changesetting.addline(popuplib.langstring('0. ', lang['just back'])) changesetting.menuselect = _changesetting_select changesetting._xa = [module, variable, parent] menulist.append(changesetting) return changesetting
def Intro_menu(self, userid): info = popuplib.create('intro_menu') info.addline('Queue Plugin') info.addline('=> Running [Queue] 0.9.8v') info.addline(' ') info.addline('1. Commands') info.addline('2. Menus') info.addline('3. Credits') info.addline('4. Modules') info.addline(' ') info.addline('0 Exit') info.enablekeys = "08" info.unsend(userid) info.send(userid) info.delete() info.menuselect = None
def getTop10Popup(self): """ Returns a popup that has the top10 player's info populated """ if len(self.ranklist) >= 10: top10 = self.ranklist[0:10] else: top10 = self.ranklist # Potential referencing issue if popuplib.exists("ultirank_top10"): popuplib.delete("ultirank_top10") rankPopup = popuplib.create("ultirank_top10") rankPopup.addline("[UltiRank %s] Top 10" % info.version) rankPopup.addline("=================================") for i in range(len(top10)): rankPopup.addline("%d. %s: %d points (KDR: %s)" % (i+1, top10[i][3], top10[i][0], self.getKDR(top10[i][1], top10[i][2]))) rankPopup.addline(" ") rankPopup.addline("0. Close") return rankPopup
def _variableEditMenu(userid, module, variable, parent): if str(module) != 'core': descr = str(variable._descr) if len(descr) > 100: descr = descr[0:50] + '\n' + descr[50:50] + '\n' + descr[100:50] elif len(descr) > 50: descr = descr[0:50] + '\n' + descr[50:50] changesetting = popuplib.create('xachangesettingmenu_'+str(random.randint(1, 10))+'_'+str(userid)+'_'+variable.getName()) changesetting.addline(lang('change setting')) changesetting.addlineAll('Name: '+variable.getName()) changesetting.addlineAll('Value: '+str(variable)) if str(module) != 'core': changesetting.addlineAll(descr) changesetting.addlineAll(' ') changesetting.addline(lang('variable warning')) changesetting.addlineAll('------------------------------------') changesetting.addline(popuplib.langstring('->1. ',lang['type value'])) changesetting.addline(popuplib.langstring('->2. ',lang['default value'])) changesetting.addlineAll('------------------------------------') if str(variable).isdigit(): changesetting.addlineAll('->3. +1') changesetting.addlineAll('->4. -1') changesetting.addlineAll('->5. +10') changesetting.addlineAll('->6. -10') changesetting.addlineAll('->7. +100') changesetting.addlineAll('->8. -100') changesetting.addlineAll('------------------------------------') changesetting._xatype = 'int' elif str(variable).replace('.', '').isdigit(): changesetting.addlineAll('->3. +0.1') changesetting.addlineAll('->4. -0.1') changesetting.addlineAll('->5. +1.0') changesetting.addlineAll('->6. -1.0') changesetting.addlineAll('->7. +10.0') changesetting.addlineAll('->8. -10.0') changesetting.addlineAll('------------------------------------') changesetting._xatype = 'float' else: changesetting._xatype = 'str' if str(module) != 'core': changesetting.addline(popuplib.langstring('->9. ',lang['save back'])) changesetting.addline(popuplib.langstring('0. ',lang['just back'])) changesetting.menuselect = _changesetting_select changesetting._xa = [module, variable, parent] menulist.append(changesetting) return changesetting
def buildPopups(): # Get the custom text for the popup with get_game_dir( 'cfg/gungame51/' + 'included_addon_configs/gg_welcome_msg.txt').open() as customFile: customText = customFile.readlines() # Remove unnecessary characters customText = [x.strip() for x in customText] # Ignore commented lines customText = filter(lambda x: x[:2] != '//', customText) # Create a new popuplib instance menu = popuplib.create('gg_welcome') menu.addline(title) menu.addline('-' * 30) # For each line of custom text for line in customText: # If there is nothing on the line, make it a single space to show up # on the menu if not line: line = ' ' # Replace variables in the line line = line.replace('$server', str(es.ServerVar('hostname'))) line = line.replace('$date', time.strftime('%d/%m/%Y')) line = line.replace('$time', time.strftime('%H:%M:%S')) # Add the line to the menu menu.addline(line) # Create the rest of the menu menu.addline('-' * 30) menu.addline('->1. Included Addons') menu.select(1, welcome_handler) menu.addline('->2. Custom Addons') menu.select(2, welcome_handler) menu.addline('-' * 30) menu.addline('0. Cancel') # Set the timeout for the menu menu.timeout('send', int(gg_welcome_msg_timeout)) menu.timeout('view', int(gg_welcome_msg_timeout))
def tellPersonalRank(self, userid): """ Use a popup to display the rank """ popupName = "ultirank_rank_%s" % str(userid) playerRank = self.getPersonalRank(self.identifyPlayer(userid)) if popuplib.exists(popupName): popuplib.delete(popupName) rpopup = popuplib.create(popupName) rpopup.addline(playerlib.Player(userid).name) rpopup.addline("================") rpopup.addline("Rank: %d of %d" % (playerRank[0], len(self.ranklist))) rpopup.addline("Points: %d" % playerRank[1]) rpopup.addline("Kills: %d" % playerRank[2]) rpopup.addline("Deaths: %d" % playerRank[3]) rpopup.addline("KDR: %s" % self.getKDR(playerRank[2], playerRank[3])) rpopup.addline(" ") rpopup.addline("0. Close") rpopup.send(userid) if self.readonly: self.tellplayer(userid, "The ranking system is currently in read-only mode. Your kills and deaths will not be logged.")
def buildPopups(): # Get the custom text for the popup with get_game_dir('cfg/gungame51/' + 'included_addon_configs/gg_welcome_msg.txt').open() as customFile: customText = customFile.readlines() # Remove unnecessary characters customText = [x.strip() for x in customText] # Ignore commented lines customText = filter(lambda x: x[:2] != '//', customText) # Create a new popuplib instance menu = popuplib.create('gg_welcome') menu.addline(title) menu.addline('-' * 30) # For each line of custom text for line in customText: # If there is nothing on the line, make it a single space to show up # on the menu if not line: line = ' ' # Replace variables in the line line = line.replace('$server', str(es.ServerVar('hostname'))) line = line.replace('$date', time.strftime('%d/%m/%Y')) line = line.replace('$time', time.strftime('%H:%M:%S')) # Add the line to the menu menu.addline(line) # Create the rest of the menu menu.addline('-' * 30) menu.addline('->1. Included Addons') menu.select(1, welcome_handler) menu.addline('->2. Custom Addons') menu.select(2, welcome_handler) menu.addline('-' * 30) menu.addline('0. Cancel') # Set the timeout for the menu menu.timeout('send', int(gg_welcome_msg_timeout)) menu.timeout('view', int(gg_welcome_msg_timeout))
def create_menu(): menu = popuplib.create("xaupdate_menu") menu.addline("XA Update Check") menu.addline(" ") menu.addline("XA Version: %s" % xa.info.version) if check.remote_version: menu.addline("Current Release: %s" % check.remote_version) else: menu.addline("Current Release: %s" % check.remote_version) menu.addline(" ") if None == check.last: menu.addline("Last checked: Never") else: menu.addline("Last checked: %s" % time.strftime("%d/%m/%y %H:%M", time.gmtime(check.last))) menu.addline(" ") if check.remote_version and xa.info.version != check.remote_version: menu.addline("A newer version is available!") else: menu.addline("XA is up to date") menu.addline(" ") menu.addline("->0. Close")
def create_menu(): menu = popuplib.create('xaupdate_menu') menu.addline('XA Update Check') menu.addline(' ') menu.addline('XA Version: %s' % xa.info.version) if check.remote_version: menu.addline('Current Release: %s' % check.remote_version) else: menu.addline('Current Release: %s' % check.remote_version) menu.addline(' ') if None == check.last: menu.addline('Last checked: Never') else: menu.addline('Last checked: %s' % time.strftime("%d/%m/%y %H:%M", time.gmtime(check.last))) menu.addline(' ') if check.remote_version and xa.info.version != check.remote_version: menu.addline('A newer version is available!') else: menu.addline('XA is up to date') menu.addline(' ') menu.addline('->0. Close')
def chosenPlayer(self, userid, choice, popupid): """ This method builds a menu about a certain player. It will detail the simple attributes of the player then sets out certain commands we can execute regarding the user. Finally send the menu @PARAM userid - the id of the user we will send the menu to @PARAM choice - the steamid of the user the popup will represent @PARAM popupid - the name of the popup which was used to access this method """ details = self.getDetails(choice) playerMenu = popuplib.create("sourcerpg_player%s" % choice) playerMenu.addline("=== %s Admin (%s) ===" % (sourcerpg.prefix, details['name'])) playerMenu.addline("-" * 30) playerMenu.addline("Status: %s" % { True: "Online", False: "Offline" }[self.isOnline(choice)]) playerMenu.addline("Level: %s" % details['level']) playerMenu.addline( "XP: %s/%s" % (details['xp'], details['level'] * int(sourcerpg.xpIncrement) + int(sourcerpg.startXp))) playerMenu.addline(" ") playerMenu.addline("->1. Give Experience") playerMenu.addline("->2. Give Levels") playerMenu.addline("->3. Give Credits") playerMenu.addline("->4. Upgrade a skill") playerMenu.addline("->5. Downgrade a skill") playerMenu.addline("->6. Max all skills") playerMenu.addline(" ") playerMenu.addline("->8. Reset Skills") playerMenu.addline("-" * 30) playerMenu.addline("0. Back") playerMenu.menuselectfb = self.executePlayerOption playerMenu.submenu(10, popupid) playerMenu.send(userid)
def load(): # Delete the popup if it exists if popuplib.exists('ggLevelMenu'): popuplib.unsendname('ggLevelMenu', getUseridList('#human')) popuplib.delete('ggLevelMenu') # Let's create the "gungameLevelMenu" popup ggLevelMenu = popuplib.create('ggLevelMenu') # Create empty instance of the popup ggLevelMenu.addline('->1. LEVEL') ggLevelMenu.addline(' * ') ggLevelMenu.addline(' * ') ggLevelMenu.addline(' * ') ggLevelMenu.addline('->2. WINS') ggLevelMenu.addline(' * ') ggLevelMenu.addline('-> 9. View Leaders Menu') ggLevelMenu.select(9, send_leader_menu) ggLevelMenu.prepuser = prep_level_menu ggLevelMenu.timeout('send', 10) ggLevelMenu.timeout('view', 10) # Register command registerSayCommand('!level', level_menu_cmd, 'Displays a !level menu.')
def development(userid): steamid = es.getplayersteamid(userid) QueueAPI.Validate(userid, 0) timer = es.import_addon("queue_timer/plugins/timer") player = playerlib.getPlayer(userid) timer.player[steamid]["disabled"] = 1 info = popuplib.create('development') info.addline('Development features') info.addline('---------------------') if client[steamid]["esp"] == "Off": info.addline('->1. ESP [Off]') else: info.addline('->1. ESP [On]') if client[steamid]["strafe_sync"] == "Off": info.addline('->2. Strafe Re-Sync [Off]') else: info.addline('->2. Strafe Re-Sync [On]') info.addline('----------------------') info.addline('0. Exit') info.enablekeys = "123456780" info.unsend(userid) info.send(userid) info.delete() info.menuselect = development_select
def commands(userid): steamid = es.getplayersteamid(userid) QueueAPI.Validate(userid, 0) player = playerlib.getPlayer(userid) info = popuplib.create('commands') info.addline('<!commands list> ') info.addline('Timer Commands:') info.addline(' ') info.addline('!r') info.addline('!b <number>') info.addline('!end') info.addline('!bend <number>') info.addline('!wr ') info.addline('!bwr ') info.addline('!rank <name|steamid>') info.addline('!crank <name|steamid> ') info.addline('!top') info.addline('!ctop <country name>') info.addline('!partner | !p') info.addline('!unpartner') info.addline('!tags') info.addline('!points <map name>') info.addline('!mode | !style | (!sw,!n,!hsw, !w)') info.addline('!hud | !settings') info.addline('!stop | Stops your timer') info.addline(' ') info.addline('Server Commands:') info.addline('!retry, !tp, !cp, !trikz, !lj, !ip') info.addline('!spec | !spectate') info.addline(' ') info.addline('0. Exit') info.enablekeys = "123456780" info.unsend(userid) info.send(userid) info.delete() info.menuselect = None
def playerPopupMenuselect(userid, choice, popupid): mapName = str(currentMap) if mapDicts[mapName]: if mapDicts[mapName][str(choice)]: tokens = {} tokens['steamid'] = str(choice) tokens['name'] = mapDicts[mapName][str(choice)]["name"] del mapDicts[mapName][str(choice)] tell(userid, 'remove player', tokens) if playerList: playerList.send(userid) else: if "STEAM" in str(choice): tell(userid, 'failed remove player', {}) if playerList: playerList.send(userid) else: tell(userid, 'no map records', {}) adminPopup = popuplib.create("surftimer_admin") adminPopup.addline("Surf Timer Admin") adminPopup.addline("-" * 30) adminPopup.addline("->1. Add/Move the start position") adminPopup.addline("->2. Add/Move the finish position") adminPopup.addline("->3. Delete map positions and times") adminPopup.addline("->4. Delete single record from map") adminPopup.addline("-" * 30) adminPopup.addline("0. Close") adminPopup.menuselectfb = adminPopupMenuselect
def load(): es.dbgmsg(1,'*****authmanage load') xaauthcmd = xaauthmanage.addCommand('xa_auth', _sendmain, 'manage_auth', 'ADMIN') xaauthcmd.register('say') if authaddon == 'group_auth': """ GroupAuth specific setup """ global db,gauthmain,groupsmain,newgroup,usermenu,capmain db = connection(es.getAddonPath('examples/auth/group_auth') + '/es_group_auth.sqldb') xanewgroupcmd = xaauthmanage.addCommand('newgroup', _inputbox_handle, 'manage_auth', 'ADMIN', 'Add group') xanewgroupcmd.register('console') gauthmain = popuplib.easymenu('maingroupauthmenu',None,_gauthmain_select) gauthmain.settitle(lang['auth manage']) gauthmain.addoption('players', lang['current players']) gauthmain.addoption('groups', lang['groups']) gauthmain.addoption('users', lang['users']) gauthmain.addoption('capabilities', lang['capabilities']) xaauthmanage.addMenu('maingroupauthmenu',lang['xa menu choice'],'maingroupauthmenu','manage_auth','ADMIN') groupsmain = popuplib.create('groupsmainmenu') groupsmain.addline(lang('manage groups')) groupsmain.addlineAll('-------------------------------') groupsmain.addline(popuplib.langstring('->1. ',lang['groups users'])) groupsmain.addline(popuplib.langstring('->2. ',lang['groups caps'])) groupsmain.addline(popuplib.langstring('->3. ',lang['add group'])) groupsmain.addline(popuplib.langstring('->4. ',lang['remove group'])) groupsmain.addlineAll('-------------------------------') groupsmain.addline(popuplib.langstring('9. ',lang['main menu'])) groupsmain.addline(popuplib.langstring('0. ',lang['close'])) groupsmain.select(1,_groupsmain_select) groupsmain.select(2,_groupsmain_select) groupsmain.select(3,_newgroup_handle) groupsmain.select(4,_groupsmain_select) groupsmain.submenu(9,'maingroupauthmenu') usermenu = popuplib.create('usermenu') usermenu.addlineAll('blah') usermenu.addlineAll('------------------') usermenu.addline(popuplib.langstring('->1. ',lang['drop user from group'])) usermenu.addline(popuplib.langstring('->2. ',lang['add user to group'])) usermenu.addline(popuplib.langstring('->3. ',lang['drop user from all groups'])) usermenu.addlineAll('------------------') usermenu.addline(popuplib.langstring('->8. ',lang['back'])) usermenu.addline(popuplib.langstring('->9. ',lang['main menu'])) usermenu.addlineAll('------------------') usermenu.addline(popuplib.langstring('->0. ',lang['close'])) usermenu.select(1,_user_groups) usermenu.select(2,_user_groups) usermenu.select(3,_user_dropfrom_all) usermenu.submenu(8,'usersmenu') usermenu.submenu(9,'maingroupauthmenu') capmain = popuplib.create('capmain') capmain.addline(lang['manage caps']) capmain.addlineAll('blah') capmain.addlineAll('------------------') capmain.addline(popuplib.langstring('->1. ',lang['cap groups'])) capmain.addline(popuplib.langstring('->2. ',lang['add cap to group'])) capmain.addline(popuplib.langstring('->3. ',lang['remove cap from group'])) capmain.addlineAll('------------------') capmain.addline(popuplib.langstring('->8. ',lang['back'])) capmain.addline(popuplib.langstring('->9. ',lang['main menu'])) capmain.addlineAll('------------------') capmain.addline(popuplib.langstring('->0. ',lang['close'])) capmain.select(1, _capmain_select) capmain.select(2, _capmain_select) capmain.select(3, _capmain_select) capmain.submenu(8,'capsmenu') capmain.submenu(9,'maingroupauthmenu') xaauthmanage.logging.log('group_auth use setup complete.') elif authaddon == 'basic_auth': """ BasicAuth specific setup """ global bauthmain, b_admins, b_admins_path, admindetail, basicadmins, basicadmins_default, adminlevel b_admins = {} b_admins_path = es.getAddonPath('xa/modules/xaauthmanage') + '/admins' basicadmins_default = str(es.ServerVar('BASIC_AUTH_ADMIN_LIST')) es.dbgmsg(1,'basicadmins_default=%s' %basicadmins_default) basicadmins = basicadmins_default.split(';') _basic_auth_convar() adminlevel = 0 bauthmain = popuplib.easymenu('mainbasicauthmenu',None,_bauthmain_select) bauthmain.settitle(lang['auth manage']) bauthmain.addoption('players', lang['current players']) bauthmain.addoption('admins', lang['admin list']) xaauthmanage.addMenu('mainbasicauthmenu',lang['xa menu choice'],'mainbasicauthmenu','manage_auth','ADMIN') admindetail = popuplib.create('admindetail') admindetail.addline(lang('admin detail')) admindetail.addlineAll('------------------') admindetail.addline('name') admindetail.addline('steam') admindetail.addline('userid') admindetail.addline('status') admindetail.addline('level') admindetail.addlineAll('------------------') admindetail.addline(popuplib.langstring('->1. ',lang['suspend admin'])) admindetail.addline(popuplib.langstring('->2. ',lang['unsuspend admin'])) admindetail.addline(popuplib.langstring('->3. ',lang['remove admin'])) admindetail.addlineAll('------------------') admindetail.addline(popuplib.langstring('8. ',lang['main menu'])) admindetail.addline(popuplib.langstring('9. ',lang['back'])) admindetail.addline(popuplib.langstring('0. ',lang['close'])) admindetail.select(1, _admin_suspend) admindetail.select(2, _admin_unsuspend) admindetail.select(3, _admin_remove) admindetail.submenu(8, 'mainbasicauthmenu') admindetail.select(9, _adminlist) xaauthmanage.logging.log('basic_auth use setup complete.') """ If the addon is loaded whilst people are playing, ensure they are in the database. """ for player in es.getUseridList(): fakeEventVariable = {} fakeEventVariable['es_steamid'] = es.getplayersteamid(player) fakeEventVariable['es_username'] = es.getplayername(player) player_activate(fakeEventVariable)
def load(): global vote_list xavotemenu = popuplib.easymenu("xavotemenu", "_vote_type", voteOption) xavotemenu.settitle(xalanguage["select vote"]) xavote.addMenu("xavotemenu", xalanguage["vote"], "xavotemenu", "start_vote", "ADMIN") registerVoteMenu("create" , xalanguage["create vote"] , customVote, serverCmdFunction = customVoteCommand) xavote.addCommand("xa_set_title", customVoteTitle, "set_a_title", "ADMIN").register("console") xavote.addCommand("xa_set_options", customVoteQuestions, "set_vote_option", "ADMIN").register("console") submenus = [] if xavoterconlist: for line in xavoterconlist: if not line.startswith('//') and line != '': line = line.split('"') title = line[1] question = line[3] command = line[4] command = command.split('//') command = command[0] vote_list[title] = {} vote_list[title]['question'] = question vote_list[title]['command'] = command vote_list[title]['type'] = 'rcon' submenus.append(title) registerVoteMenu("rcon" , xalanguage["rcon vote"] , rconVote , submenus, rconCommand) submenus = [] if xavotelist: for line in xavotelist: if not line.startswith('//') and line != '' : line = line.split('"') title = line[1] question = line[3] vote_list[title] = {} vote_list[title]['question'] = question vote_list[title]['type'] = 'question' submenus.append(title) registerVoteMenu("question", xalanguage["question vote"], questionVote, submenus, questionCommand) mypopup = popuplib.create("multimapaccept") a = mypopup.addline a('Would you like to start the map') a(' vote now? ') a('-------------------------------') a('->1. No, add more maps') a('->2. Yes, start the vote now') a('-------------------------------') a('0. Cancel') mypopup.menuselect = MultiMapConfirm registerVoteMenu("multimap", xalanguage["build multi map"], MultiMap, serverCmdFunction= MultiMapCommand) registerVoteMenu("random", xalanguage["random map vote"], RandomMapVote, serverCmdFunction= RandomCommand) registerVoteMenu("stopvotes", xalanguage["stop votes"], StopVotes, serverCmdFunction=StopVotesCommand) """ If XA loads late, then ensure all users are added to the dictionary. """ for player in map(str, es.getUseridList() ): player_activate({'userid':player}) if str(es.ServerVar('eventscripts_currentmap')) != "": es_map_start({'mapname':str(es.ServerVar('eventscripts_currentmap'))})
def load(): es.dbgmsg(0, "[SH] Loading.....") es.doblock('corelib/noisy_on') config.execute() # Executes the .cfg to register changes global popup_language popup_language = es.ServerVar('popup_language') global rounds_played rounds_played = 0 es.server.queuecmd('es_xload superhero/heroes') es.server.queuecmd('es_xload superhero/admins') # Create a group global heroes heroes = [] ### Get the Strings the popup cmdlist_popup = langlib.Strings( es.getAddonPath("superhero") + "/languages/cmdlist_popup.ini") # Create popups global commandlist commandlist = popuplib.easymenu('commandlist', 'choice', commandlist_selection) commandlist.settitle('All Commands') commandlist.addoption('help', cmdlist_popup('cmd_help', lang=str(popup_language))) # Done commandlist.addoption('herolist', cmdlist_popup('cmd_herolist', lang=str(popup_language))) # Done commandlist.addoption( 'playerinfo', cmdlist_popup('cmd_playerinfo', lang=str(popup_language))) commandlist.addoption('myheroes', cmdlist_popup('cmd_myheroes', lang=str(popup_language))) # Done commandlist.addoption('clearpowers', cmdlist_popup('cmd_clearpowers', lang=str(popup_language))) # Done commandlist.addoption('showmenu', cmdlist_popup('cmd_showmenu', lang=str(popup_language))) # Done commandlist.addoption('showxp', cmdlist_popup('cmd_showxp', lang=str(popup_language))) # Done commandlist.addoption(None, cmdlist_popup('cmd_drop', lang=str(popup_language))) # Done commandlist.addoption(None, cmdlist_popup('cmd_buyxp', lang=str(popup_language))) commandlist.addoption( None, cmdlist_popup('cmd_binding', lang=str(popup_language))) helpbox_popup = langlib.Strings( es.getAddonPath("superhero") + "/languages/helpbox_popup.ini") global helpbox helpbox = popuplib.create('helpbox') helpbox.addline(helpbox_popup('helpbox_1', lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_2', lang=str(popup_language))) helpbox.addline('\n\n') helpbox.addline(helpbox_popup('helpbox_3', lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_4', lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_5', lang=str(popup_language))) helpbox.addline(helpbox_popup('helpbox_6', lang=str(popup_language))) # Saycommands register etc. cmdlib.registerSayCommand('/commandlist', 'superhero/commandlist', 'COMMANDLIST') cmdlib.registerSayCommand('/shmenu', 'superhero/commandlist', 'SHMENU') cmdlib.registerSayCommand('/sh', 'superhero/commandlist', 'SH') cmdlib.registerSayCommand('/help', superherohelp, 'HELP') cmdlib.registerSayCommand('/showmenu', showmenu, 'SHOWMENU') cmdlib.registerSayCommand('/drop', drop, 'DROP') cmdlib.registerSayCommand('/showxp', showxp, 'SHOWXP') cmdlib.registerSayCommand('/myheroes', myheroes, 'MYHEROES') cmdlib.registerSayCommand('hashero', 'superhero/hashero', 'HASHERO') cmdlib.registerSayCommand('/buyxp', buyxp, 'BUYXP') cmdlib.registerSayCommand('/herolist', herolist, 'HEROLIST') cmdlib.registerSayCommand('/clearpowers', clearpowers, 'CLEARPOWERS') cmdlib.registerSayCommand('/playerinfo', playerinfo, 'PLAYERINFO') cmdlib.registerClientCommand('+power1', power, "+power1") cmdlib.registerClientCommand('-power1', poweroff, "-power1") cmdlib.registerClientCommand('+power2', power, "+power2") cmdlib.registerClientCommand('-power2', poweroff, "-power2") cmdlib.registerClientCommand('+power3', power, "+power3") cmdlib.registerClientCommand('-power3', poweroff, "-power3") es.dbgmsg(0, "[SH] Loading Done.")
def sendStats(self, args=()): if not (self.TakenPlayers or self.GivenPlayers or self.KilledPlayers): return self.Data = {} self.Totals = {} if self.TakenPlayers: type = 'Attacker' if self.setting in [1, 2] else 'Attackers' self.createdata(type, self.TakenPlayers) if self.GivenPlayers: self.createdata('Wounded', self.GivenPlayers) if self.KilledPlayers: self.createdata('Killed', self.KilledPlayers) if args: type = xalang(args[0], self.lang) killer = '%s %s' % (type, xalang('HeadShot', {}, self.lang)) if args[1] else type self.Data['Killer'] = [ xalang( '%sText' % args[0], { 'killertype': killer, 'name': args[2], 'weapon': args[3], 'distance': args[4], 'health': args[5] }, self.lang) ] if self.setting in [1, 2]: for x in ['Attacker', 'Wounded', 'Killed', 'Killer']: if x in self.Data: for y in self.Data[x]: es.tell(self.userid, '#multi', y) return time = victimstats_timeout_death if 'Killer' in self.Data else victimstats_timeout_round if self.setting in [3, 4]: user_popup = popuplib.create('user_popup') number = 0 for x in ['Attackers', 'Wounded', 'Killed', 'Killer']: if not x in self.Data: continue number += 1 if x != 'Killer': user_popup.addline('->%s. %s' % (number, xalang(x, self.lang))) for y in self.Data[x]: user_popup.addline(gui2(y, x)) else: for y in self.Data[x]: user_popup.addline('->%s. %s' % (number, gui(y))) user_popup.timeout('view', time) user_popup.send(self.userid) if self.setting == 5: main_popup = popuplib.create('%sMain' % self.userid) take_popup = popuplib.create('%sAttacker' % self.userid) give_popup = popuplib.create('%sWounded' % self.userid) kill_popup = popuplib.create('%sKilled' % self.userid) types = { 1: { 'name': 'Attackers', 'popup': take_popup }, 2: { 'name': 'Wounded', 'popup': give_popup }, 3: { 'name': 'Killed', 'popup': kill_popup }, 4: { 'name': 'Main', 'popup': main_popup } } for x in types: popupid = types[x]['popup'] popupid.timeout('view', time) name = types[x]['name'] if name != 'Main': if name in self.Data: enemies = len(self.Data[name]) enemytype = 'enemy' if enemies == 1 else 'enemies' hits = self.Totals[name].hits hittype = 'hit' if hits == 1 else 'hits' kills = self.Totals[name].kills killtype = 'kill' if kills == 1 else 'kills' type = 'Gui%sPlus' % name if name == 'Killed' and kills > enemies else 'Gui%s' % name text = xalang( type, { 'total_enemies': enemies, 'enemies': xalang(enemytype, self.lang), 'total_kills': kills, 'killtype': xalang(killtype, self.lang), 'total_dmg': self.Totals[name].damage, 'total_hits': hits, 'hittype': xalang(hittype, self.lang) }, self.lang) else: text = xalang('No%s' % name, {}, self.lang) main_popup.addline(text) main_popup.addline(' ') popupid.addline(text) if name in self.Data: for y in self.Data[name]: popupid.addline(gui2(y, name)) popupid.addline(' ') if 'Killer' in self.Data: for y in self.Data['Killer']: popupid.addline(gui(y)) popupid.addline(' ') for y in types: z = types[y]['name'] if not name in [z, 'Main']: popupid.addline('->%s. %s' % (y, xalang(z, self.lang))) types[y]['popup'].submenu(x, popupid) main_popup.send(self.userid) xavictimstats.logging.log("was sent victimstats data", self.userid)
def sendStats(self,args=()): if not (self.TakenPlayers or self.GivenPlayers or self.KilledPlayers): return self.Data = {} self.Totals = {} if self.TakenPlayers: type = 'Attacker' if self.setting in [1,2] else 'Attackers' self.createdata(type,self.TakenPlayers) if self.GivenPlayers: self.createdata('Wounded',self.GivenPlayers) if self.KilledPlayers: self.createdata('Killed',self.KilledPlayers) if args: type = xalang(args[0],self.lang) killer = '%s %s'%(type,xalang('HeadShot',{},self.lang)) if args[1] else type self.Data['Killer'] = [xalang('%sText'%args[0],{'killertype':killer,'name':args[2],'weapon':args[3],'distance':args[4],'health':args[5]},self.lang)] if self.setting in [1,2]: for x in ['Attacker','Wounded','Killed','Killer']: if x in self.Data: for y in self.Data[x]: es.tell(self.userid,'#multi',y) return time = victimstats_timeout_death if 'Killer' in self.Data else victimstats_timeout_round if self.setting in [3,4]: user_popup = popuplib.create('user_popup') number = 0 for x in ['Attackers','Wounded','Killed','Killer']: if not x in self.Data: continue number += 1 if x != 'Killer': user_popup.addline('->%s. %s'%(number,xalang(x,self.lang))) for y in self.Data[x]: user_popup.addline(gui2(y,x)) else: for y in self.Data[x]: user_popup.addline('->%s. %s'%(number,gui(y))) user_popup.timeout('view',time) user_popup.send(self.userid) if self.setting == 5: main_popup = popuplib.create('%sMain'%self.userid) take_popup = popuplib.create('%sAttacker'%self.userid) give_popup = popuplib.create('%sWounded'%self.userid) kill_popup = popuplib.create('%sKilled'%self.userid) types = {1:{'name':'Attackers','popup':take_popup},2:{'name':'Wounded','popup':give_popup},3:{'name':'Killed','popup':kill_popup},4:{'name':'Main','popup':main_popup}} for x in types: popupid = types[x]['popup'] popupid.timeout('view',time) name = types[x]['name'] if name != 'Main': if name in self.Data: enemies = len(self.Data[name]) enemytype = 'enemy' if enemies == 1 else 'enemies' hits = self.Totals[name].hits hittype = 'hit' if hits == 1 else 'hits' kills = self.Totals[name].kills killtype = 'kill' if kills == 1 else 'kills' type = 'Gui%sPlus'%name if name == 'Killed' and kills > enemies else 'Gui%s'%name text = xalang(type,{'total_enemies':enemies,'enemies':xalang(enemytype,self.lang),'total_kills':kills,'killtype':xalang(killtype,self.lang),'total_dmg':self.Totals[name].damage,'total_hits':hits,'hittype':xalang(hittype,self.lang)},self.lang) else: text = xalang('No%s'%name,{},self.lang) main_popup.addline(text) main_popup.addline(' ') popupid.addline(text) if name in self.Data: for y in self.Data[name]: popupid.addline(gui2(y,name)) popupid.addline(' ') if 'Killer' in self.Data: for y in self.Data['Killer']: popupid.addline(gui(y)) popupid.addline(' ') for y in types: z = types[y]['name'] if not name in [z,'Main']: popupid.addline('->%s. %s'%(y,xalang(z,self.lang))) types[y]['popup'].submenu(x,popupid) main_popup.send(self.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 load(): global vote_list xavotemenu = popuplib.easymenu("xavotemenu", "_vote_type", voteOption) xavotemenu.settitle(xalanguage["select vote"]) xavote.addMenu("xavotemenu", xalanguage["vote"], "xavotemenu", "xa_vote", "ADMIN") registerVoteMenu("create", xalanguage["create vote"], customVote, serverCmdFunction=customVoteCommand) xavote.addCommand("xa_set_title", customVoteTitle, "xa_vote", "ADMIN").register("console") xavote.addCommand("xa_set_options", customVoteQuestions, "xa_vote", "ADMIN").register("console") submenus = [] if xavoterconlist: for line in xavoterconlist: if not line.startswith('//') and line != '': line = line.replace("'", '"').split('"') if len(line) > 4: title = line[1] question = line[3] command = line[4].split('//')[0].strip() vote_list[title] = {} vote_list[title]['question'] = question vote_list[title]['command'] = command vote_list[title]['type'] = 'rcon' submenus.append(title) else: xavote.logging.log( "invalid xavoterconlist.txt entry %s" % '"'.join(line), userid, True) registerVoteMenu("rcon", xalanguage["rcon vote"], rconVote, submenus, rconCommand) submenus = [] if xavotelist: for line in xavotelist: if not line.startswith('//') and line != '': line = line.split('"') title = line[1] question = line[3] vote_list[title] = {} vote_list[title]['question'] = question vote_list[title]['type'] = 'question' submenus.append(title) registerVoteMenu("question", xalanguage["question vote"], questionVote, submenus, questionCommand) mypopup = popuplib.create("multimapaccept") a = mypopup.addline a('Would you like to start the map') a(' vote now? ') a('-------------------------------') a('->1. No, add more maps') a('->2. Yes, start the vote now') a('-------------------------------') a('0. Cancel') mypopup.menuselect = MultiMapConfirm registerVoteMenu("multimap", xalanguage["build multi map"], MultiMap, serverCmdFunction=MultiMapCommand) registerVoteMenu("random", xalanguage["random map vote"], RandomMapVote, serverCmdFunction=RandomCommand) registerVoteMenu("stopvotes", xalanguage["stop votes"], StopVotes, serverCmdFunction=StopVotesCommand) """ If XA loads late, then ensure all users are added to the dictionary. """ for player in map(str, es.getUseridList()): player_activate({'userid': player}) if str(es.ServerVar('eventscripts_currentmap')) != "": es_map_start({'mapname': str(es.ServerVar('eventscripts_currentmap'))})
def load(): es.dbgmsg(1, '*****authmanage load') xaauthcmd = xaauthmanage.addCommand('xa_auth', _sendmain, 'manage_auth', 'ADMIN') xaauthcmd.register('say') if authaddon == 'group_auth': """ GroupAuth specific setup """ global db, gauthmain, groupsmain, newgroup, usermenu, capmain db = connection( es.getAddonPath('examples/auth/group_auth') + '/es_group_auth.sqldb') xanewgroupcmd = xaauthmanage.addCommand('newgroup', _inputbox_handle, 'manage_auth', 'ADMIN', 'Add group') xanewgroupcmd.register('console') gauthmain = popuplib.easymenu('maingroupauthmenu', None, _gauthmain_select) gauthmain.settitle(lang['auth manage']) gauthmain.addoption('players', lang['current players']) gauthmain.addoption('groups', lang['groups']) gauthmain.addoption('users', lang['users']) gauthmain.addoption('capabilities', lang['capabilities']) xaauthmanage.addMenu('maingroupauthmenu', lang['xa menu choice'], 'maingroupauthmenu', 'manage_auth', 'ADMIN') groupsmain = popuplib.create('groupsmainmenu') groupsmain.addline(lang('manage groups')) groupsmain.addlineAll('-------------------------------') groupsmain.addline(popuplib.langstring('->1. ', lang['groups users'])) groupsmain.addline(popuplib.langstring('->2. ', lang['groups caps'])) groupsmain.addline(popuplib.langstring('->3. ', lang['add group'])) groupsmain.addline(popuplib.langstring('->4. ', lang['remove group'])) groupsmain.addlineAll('-------------------------------') groupsmain.addline(popuplib.langstring('9. ', lang['main menu'])) groupsmain.addline(popuplib.langstring('0. ', lang['close'])) groupsmain.select(1, _groupsmain_select) groupsmain.select(2, _groupsmain_select) groupsmain.select(3, _newgroup_handle) groupsmain.select(4, _groupsmain_select) groupsmain.submenu(9, 'maingroupauthmenu') usermenu = popuplib.create('usermenu') usermenu.addlineAll('blah') usermenu.addlineAll('------------------') usermenu.addline( popuplib.langstring('->1. ', lang['drop user from group'])) usermenu.addline( popuplib.langstring('->2. ', lang['add user to group'])) usermenu.addline( popuplib.langstring('->3. ', lang['drop user from all groups'])) usermenu.addlineAll('------------------') usermenu.addline(popuplib.langstring('->8. ', lang['back'])) usermenu.addline(popuplib.langstring('->9. ', lang['main menu'])) usermenu.addlineAll('------------------') usermenu.addline(popuplib.langstring('->0. ', lang['close'])) usermenu.select(1, _user_groups) usermenu.select(2, _user_groups) usermenu.select(3, _user_dropfrom_all) usermenu.submenu(8, 'usersmenu') usermenu.submenu(9, 'maingroupauthmenu') capmain = popuplib.create('capmain') capmain.addline(lang['manage caps']) capmain.addlineAll('blah') capmain.addlineAll('------------------') capmain.addline(popuplib.langstring('->1. ', lang['cap groups'])) capmain.addline(popuplib.langstring('->2. ', lang['add cap to group'])) capmain.addline( popuplib.langstring('->3. ', lang['remove cap from group'])) capmain.addlineAll('------------------') capmain.addline(popuplib.langstring('->8. ', lang['back'])) capmain.addline(popuplib.langstring('->9. ', lang['main menu'])) capmain.addlineAll('------------------') capmain.addline(popuplib.langstring('->0. ', lang['close'])) capmain.select(1, _capmain_select) capmain.select(2, _capmain_select) capmain.select(3, _capmain_select) capmain.submenu(8, 'capsmenu') capmain.submenu(9, 'maingroupauthmenu') xaauthmanage.logging.log('group_auth use setup complete.') elif authaddon == 'basic_auth': """ BasicAuth specific setup """ global bauthmain, b_admins, b_admins_path, admindetail, basicadmins, basicadmins_default, adminlevel b_admins = {} b_admins_path = es.getAddonPath('xa/modules/xaauthmanage') + '/admins' basicadmins_default = str(es.ServerVar('BASIC_AUTH_ADMIN_LIST')) es.dbgmsg(1, 'basicadmins_default=%s' % basicadmins_default) basicadmins = basicadmins_default.split(';') _basic_auth_convar() adminlevel = 0 bauthmain = popuplib.easymenu('mainbasicauthmenu', None, _bauthmain_select) bauthmain.settitle(lang['auth manage']) bauthmain.addoption('players', lang['current players']) bauthmain.addoption('admins', lang['admin list']) xaauthmanage.addMenu('mainbasicauthmenu', lang['xa menu choice'], 'mainbasicauthmenu', 'manage_auth', 'ADMIN') admindetail = popuplib.create('admindetail') admindetail.addline(lang('admin detail')) admindetail.addlineAll('------------------') admindetail.addline('name') admindetail.addline('steam') admindetail.addline('userid') admindetail.addline('status') admindetail.addline('level') admindetail.addlineAll('------------------') admindetail.addline(popuplib.langstring('->1. ', lang['suspend admin'])) admindetail.addline( popuplib.langstring('->2. ', lang['unsuspend admin'])) admindetail.addline(popuplib.langstring('->3. ', lang['remove admin'])) admindetail.addlineAll('------------------') admindetail.addline(popuplib.langstring('8. ', lang['main menu'])) admindetail.addline(popuplib.langstring('9. ', lang['back'])) admindetail.addline(popuplib.langstring('0. ', lang['close'])) admindetail.select(1, _admin_suspend) admindetail.select(2, _admin_unsuspend) admindetail.select(3, _admin_remove) admindetail.submenu(8, 'mainbasicauthmenu') admindetail.select(9, _adminlist) xaauthmanage.logging.log('basic_auth use setup complete.') """ If the addon is loaded whilst people are playing, ensure they are in the database. """ for player in es.getUseridList(): fakeEventVariable = {} fakeEventVariable['es_steamid'] = es.getplayersteamid(player) fakeEventVariable['es_username'] = es.getplayername(player) player_activate(fakeEventVariable)