예제 #1
0
def load():
    # Store the value of eventscripts_maphandler
    global eventscripts_maphandler_backup
    eventscripts_maphandler_backup = int(eventscripts_maphandler)

    # Set eventscripts_maphandler to 1
    eventscripts_maphandler.set(1)

    # Check to see if GunGame's voting system is to be used
    if int(gg_map_vote) == 1:

        # Create player vote command
        registerPlayerCmd()

        # Register RTV and nomination commands
        if int(gg_map_vote_rtv):
            registerSayCommand(str(gg_map_vote_rtv_command), rtv_cmd, "" + "RTV command.")
            registerSayCommand(str(gg_map_vote_nominate_command), nominate_cmd, "Nominate command.")

        # Store the current map in the list of recently played maps
        if int(gg_map_vote_dont_show_last_maps):
            list_lastMaps.append(str(eventscripts_currentmap))

        # Check file location if using list_source = 3
        mapFileClean(True)
예제 #2
0
def load():
    # Store the value of eventscripts_maphandler
    global eventscripts_maphandler_backup
    eventscripts_maphandler_backup = int(eventscripts_maphandler)

    # Set eventscripts_maphandler to 1
    eventscripts_maphandler.set(1)

    # Check to see if GunGame's voting system is to be used
    if int(gg_map_vote) == 1:

        # Create player vote command
        registerPlayerCmd()

        # Register RTV and nomination commands
        if int(gg_map_vote_rtv):
            registerSayCommand(str(gg_map_vote_rtv_command), rtv_cmd,
                               '' + 'RTV command.')
            registerSayCommand(str(gg_map_vote_nominate_command), nominate_cmd,
                               'Nominate command.')

        # Store the current map in the list of recently played maps
        if int(gg_map_vote_dont_show_last_maps):
            list_lastMaps.append(str(eventscripts_currentmap))

        # Check file location if using list_source = 3
        mapFileClean(True)
예제 #3
0
def load():
    config.execute()
    lmv['command'] = str(lmv_command)
    if lmv['command']:
        cmdlib.registerSayCommand(lmv['command'],sendVote,'Send Player Vote popup')
        cmdlib.registerClientCommand(lmv['command'],sendVote,'Send Player Vote popup')
    ini = cfglib.AddonINI(addonpath + '/strings.ini')
    ini.addValueToGroup('Vote on GamePlay','en','Vote for next GamePlay:')
    ini.addValueToGroup('Vote on Map','en','Vote on a Map:')
    ini.addValueToGroup('Start GamePlay Vote','en','#green[LooneyMapVote]#default Use the command "#lightgreen$command#default" to vote for the next GamePlay')
    ini.addValueToGroup('End GamePlay Vote','en','#green[LooneyMapVote]#default Next GamePlay will be#lightgreen $gameplay#default!')
    ini.addValueToGroup('Start Map Vote','en','#green[LooneyMapVote]#default Use the command "#lightgreen$command#default" to Vote for the next Map')
    ini.addValueToGroup('End Map Vote','en','#green[LooneyMapVote]#default Next Map is#lightgreen $nextmap#default!')
    ini.addValueToGroup('Vote Not Started','en','#green[LooneyMapVote]#default Vote has not started yet')
    ini.addValueToGroup('Between Votes','en','#green[LooneyMapVote]#default Please wait to use this command, we are between votes')
    ini.addValueToGroup('Vote Over','en','#green[LooneyMapVote]#default Sorry, voting is over')
    ini.addValueToGroup('NextMap Decided','en','#green[LooneyMapVote]#default NextMap has already been decided.#lightgreen  NextMap#default:#green $nextmap')
    ini.addValueToGroup('Already Voted','en','#green[LooneyMapVote]#default You already voted for#lightgreen $playervote')
    ini.addValueToGroup('Player Vote','en','#green[LooneyMapVote]#default $player voted for#lightgreen $choice')
    ini.addValueToGroup('Time Remaining','en','#green[LooneyMapVote]#default Vote ends in $seconds seconds')
    ini.addValueToGroup('One Second Remains','en','#green[LooneyMapVote]#default Vote ends in 1 second')
    lmv['maps'] = cfglib.AddonINI(addonpath + '/maptypes.ini')
    for mapbsp in os.listdir(str(es.ServerVar('eventscripts_gamedir')) + '/maps/'):
        if not mapbsp.endswith('.bsp'): continue
        mapname = mapbsp[0:~3]
        if mapname in str(lmv_maps_to_not_use).split(','): continue
        allmaps.add(mapname)
        if notInHeader(mapname):
            prefix = mapname.split('_')[0] + '_'
            lmv['maps'].addValueToGroup(prefix,getNumber(prefix),mapname)
    lmv['maps'].write()
    serverlang = langlib.getDefaultLang()
    for gameplay in lmv['maps']:
        ini.addValueToGroup(gameplay,serverlang,gameplay)
    first = True
    for group in ini:
        if first:
            first = False
        else:
            ini.setGroupComments(group,'')
    ini.write()
    lmv['lang'] = langlib.Strings(ini)
    if lmv_scripts_for_gameplay:
        scriptpath = addonpath + '/scriptmanager'
        if not os.path.isdir(scriptpath):
            os.makedirs(scriptpath)
        for gameplay in lmv['maps']:
            gameplay_ini[gameplay] = cfglib.AddonINI(scriptpath + '/%s.ini'%gameplay)
            gameplay_ini[gameplay].addValueToGroup('Scripts','1','')
            gameplay_ini[gameplay].setGroupComments('Scripts',['Set scripts to be loaded for maptype below','Use a different number for each and follow the same syntax'])
            gameplay_ini[gameplay].addValueToGroup('Configs','1','')
            gameplay_ini[gameplay].setGroupComments('Configs',['Set .cfg files to be executed for maptype below','Use a different number for each and follow the same syntax','Please use the path relative to <gamename>','For instance, if your cfg is in <gamename>/cfg/myconfigs/configone.cfg, you would use "cfg/myconfigs/configone"'])
            gameplay_ini[gameplay].write()
    mapVote.mapStart(str(lmv_default_gameplay))
    mapVote.resetMapVote(str(es.ServerVar('eventscripts_currentmap')))
    startTimeVote()
예제 #4
0
def load():
    # Delete the popup if it exists
    if popuplib.exists('ggLeaderMenu'):
        popuplib.unsendname('ggLeaderMenu', getUseridList('#human'))
        popuplib.delete('ggLeaderMenu')

    # Register commands
    registerSayCommand('!leader', leader_menu_cmd, 'Displays a !leader menu.')
    registerSayCommand('!leaders', leader_menu_cmd,
        'Displays a !leaders menu.')
예제 #5
0
def load():
    """
    Executed when the script loads. Ensure that the admin menu is built and
    all of the options are either other popups or functions we can call.
    """
    
    sourcerpg.addons.addAddon(addonName)
    
    cmdlib.registerSayCommand("rpg_admin", admin.mainCommand,
                              "The command to open the admin menu",
                              "sourcerpg_admin", "ADMIN", admin.failCommand)
    cmdlib.registerSayCommand("rpgadmin", admin.mainCommand,
                              "The command to open the admin menu",
                              "sourcerpg_admin", "ADMIN", admin.failCommand)
                              
    """ Register the client commands so we can use escape boxes """         
    cmdlib.registerClientCommand("rpgaddxp", admin.clientAddXp,
                                 "The command to add experience to a target",
                                 "sourcerpg_admin", "ADMIN", admin.failCommand)
    cmdlib.registerClientCommand("rpgaddlevels", admin.clientAddLevels,
                                 "The command to add levels to a target",
                                 "sourcerpg_admin", "ADMIN", admin.failCommand)
    cmdlib.registerClientCommand("rpgaddcredits", admin.clientAddCredits,
                                 "The command to add credits to a target",
                                 "sourcerpg_admin", "ADMIN", admin.failCommand)

    cmdlib.registerServerCommand("rpgaddxp", admin.clientAddXp, 
                    "rpgaddxp <steamid/username> <amount>")
    cmdlib.registerServerCommand("rpgaddlevels", admin.clientAddLevels,
                    "rpgaddlevels <steamid/username> <amount>")
    cmdlib.registerServerCommand("rpgaddcredits", admin.clientAddCredits,
                    "rpgaddcredits <steamid/username> <amount>")
                              
    """ Create the confirmation menu """
    confirmation = popuplib.easymenu("sourcerpg_confirmDeleteDatabase", "_popup_choice", popup.confirmation)
    confirmation.settitle("=== %s Confirmation ===" % sourcerpg.prefix)
    confirmation.setdescription("""\
!!! WARNING !!!
This is an irriversable effect! Once
you remove this database, you cannot
get it back. All skills / levels will
be destroyed. Are you sure you want
to continue?""")
    confirmation.addoption(True, "Yes")
    confirmation.addoption(False, "No")
                              
    """ Build the admin menu """
    admin.addOption( popup.buildOnlinePlayers,  "Online Players")
    admin.addOption( popup.buildOfflinePlayers, "Offline Players (Warning, may lag)" )
    admin.addOption( popup.buildSkills,   "Load/Unload Skills" )
    admin.addOption( popup.buildAddons,   "Load/Unload Addons" )
    admin.addOption( "sourcerpg_confirmDeleteDatabase",  "Delete Database" )
예제 #6
0
def load():
    print "[SH] Admins loading..."
    path = es.getAddonPath("superhero/admins/adminlist.txt")
    for line in open(path):
        line = str(line).rstrip()
        if line != '0':
            if line != "":
                if not '//' in line:
                    sh_admins.append(line)
                    print "[SH] %s is now a Superhero Admin" % line 
    es.dbgmsg(0, "[SH] Admins Loaded")   
    cmdlib.registerSayCommand('/sh_admin', sh_admin, 'sh_admin')
    cmdlib.registerSayCommand('/shadmin', sh_admin, 'shadmin')
예제 #7
0
def load():
    """
    Executed when the script loads. Ensure that the admin menu is built and
    all of the options are either other popups or functions we can call.
    """

    sourcerpg.addons.addAddon(addonName)

    cmdlib.registerSayCommand("rpg_admin", admin.mainCommand,
                              "The command to open the admin menu",
                              "sourcerpg_admin", "ADMIN", admin.failCommand)
    cmdlib.registerSayCommand("rpgadmin", admin.mainCommand,
                              "The command to open the admin menu",
                              "sourcerpg_admin", "ADMIN", admin.failCommand)
    """ Register the client commands so we can use escape boxes """
    cmdlib.registerClientCommand("rpgaddxp", admin.clientAddXp,
                                 "The command to add experience to a target",
                                 "sourcerpg_admin", "ADMIN", admin.failCommand)
    cmdlib.registerClientCommand("rpgaddlevels", admin.clientAddLevels,
                                 "The command to add levels to a target",
                                 "sourcerpg_admin", "ADMIN", admin.failCommand)
    cmdlib.registerClientCommand("rpgaddcredits", admin.clientAddCredits,
                                 "The command to add credits to a target",
                                 "sourcerpg_admin", "ADMIN", admin.failCommand)

    cmdlib.registerServerCommand("rpgaddxp", admin.clientAddXp,
                                 "rpgaddxp <steamid/username> <amount>")
    cmdlib.registerServerCommand("rpgaddlevels", admin.clientAddLevels,
                                 "rpgaddlevels <steamid/username> <amount>")
    cmdlib.registerServerCommand("rpgaddcredits", admin.clientAddCredits,
                                 "rpgaddcredits <steamid/username> <amount>")
    """ Create the confirmation menu """
    confirmation = popuplib.easymenu("sourcerpg_confirmDeleteDatabase",
                                     "_popup_choice", popup.confirmation)
    confirmation.settitle("=== %s Confirmation ===" % sourcerpg.prefix)
    confirmation.setdescription("""\
!!! WARNING !!!
This is an irriversable effect! Once
you remove this database, you cannot
get it back. All skills / levels will
be destroyed. Are you sure you want
to continue?""")
    confirmation.addoption(True, "Yes")
    confirmation.addoption(False, "No")
    """ Build the admin menu """
    admin.addOption(popup.buildOnlinePlayers, "Online Players")
    admin.addOption(popup.buildOfflinePlayers,
                    "Offline Players (Warning, may lag)")
    admin.addOption(popup.buildSkills, "Load/Unload Skills")
    admin.addOption(popup.buildAddons, "Load/Unload Addons")
    admin.addOption("sourcerpg_confirmDeleteDatabase", "Delete Database")
예제 #8
0
def load():
    public = es.ServerVar('hu_bt', info.version, info.name)
    public.makepublic()
    
    cmdlib.registerSayCommand('!bombtimer', _say_cmd, 'Bomb Timer')

    bomb_timer_config.execute()
    bomb_timer_setting.addoption('display', 'Display')
    bomb_timer_setting.addoption('text', 'Text')
    bomb_timer_setting.addoption('sound', 'Sound')
    bomb_timer_setting.setdefault('display', int(bomb_timer_default_display))
    bomb_timer_setting.setdefault('text', int(bomb_timer_default_text))
    bomb_timer_setting.setdefault('sound', int(bomb_timer_default_sound))
    bomb_timer_setting.addsound('ui/buttonclick.wav')

    es.log(hunter_bomb_timer_text)
    es.msg('#multi', '#green[BombTimer] #defaultLoaded')
예제 #9
0
def load():
    public = es.ServerVar('hu_bt', info.version, info.name)
    public.makepublic()

    cmdlib.registerSayCommand('!bombtimer', _say_cmd, 'Bomb Timer')

    bomb_timer_config.execute()
    bomb_timer_setting.addoption('display', 'Display')
    bomb_timer_setting.addoption('text', 'Text')
    bomb_timer_setting.addoption('sound', 'Sound')
    bomb_timer_setting.setdefault('display', int(bomb_timer_default_display))
    bomb_timer_setting.setdefault('text', int(bomb_timer_default_text))
    bomb_timer_setting.setdefault('sound', int(bomb_timer_default_sound))
    bomb_timer_setting.addsound('ui/buttonclick.wav')

    es.log(hunter_bomb_timer_text)
    es.msg('#multi', '#green[BombTimer] #defaultLoaded')
예제 #10
0
def server_cvar(event_var):
    cvar_name = event_var["cvarname"]
    cvar_value = event_var["cvarvalue"]

    # If the weapon order changed, get the new rtv_DisableLevel
    if cvar_name in ["gg_weapon_order_file", "gg_weapon_order_sort_type"]:
        global rtv_DisableLevel
        rtv_DisableLevel = get_total_levels() * gg_map_vote_rtv_levels_required / 100

    # Register RTV commmands?
    if cvar_name == "gg_map_vote_rtv":

        # Register RTV and nomination commands
        if int(cvar_value):
            registerSayCommand(str(gg_map_vote_rtv_command), rtv_cmd, "" + "RTV command.")
            registerSayCommand(str(gg_map_vote_nominate_command), nominate_cmd, "Nominate command.")
        # Unregister RTV and nomination commands
        else:
            unregisterSayCommand(str(gg_map_vote_rtv_command))
            unregisterSayCommand(str(gg_map_vote_nominate_command))
예제 #11
0
def load():
    # Exec server.cfg before gungame loads.  If gungame is loaded from autoexec
    # this is needed so that the correct values are stored.
    es.server.cmd('exec server.cfg')

    try:
        initialize()
    except:
        unload_on_error()

    # If the public variables exist, remove them
    if not es.exists('variable', 'eventscripts_gg'):
        eventscripts_gg.removeFlag('notify')
        eventscripts_gg.removeFlag('replicated')
    if not es.exists('variable', 'eventscripts_gg5'):
        eventscripts_gg5.removeFlag('notify')
        eventscripts_gg5.removeFlag('replicated')

    # Create the public variables
    eventscripts_gg.set(gungame_info('version'))
    eventscripts_gg.makepublic()
    eventscripts_gg5.set(gungame_info('version'))
    eventscripts_gg5.makepublic()


    # Update the Included/Custom Addon lists
    gungame_info('update')

    # Register !thanks command
    registerSayCommand('!thanks', thanks, 'Displays a list of those involved' +
                       'with development and testing of GunGame.')

    # Add gungame to sv_tags
    tags = set(str(sv_tags).split(','))
    tags.add('gungame')
    sv_tags.set(','.join(tags))

    # Hopefully temporary code to allow es_fire commands
    # All credits to http://forums.eventscripts.com/viewtopic.php?t=42620
    for userid in es.getUseridList():
        disable_auto_kick(userid)
예제 #12
0
def load():
    # Exec server.cfg before gungame loads.  If gungame is loaded from autoexec
    # this is needed so that the correct values are stored.
    es.server.cmd('exec server.cfg')

    try:
        initialize()
    except:
        unload_on_error()

    # If the public variables exist, remove them
    if not es.exists('variable', 'eventscripts_gg'):
        eventscripts_gg.removeFlag('notify')
        eventscripts_gg.removeFlag('replicated')
    if not es.exists('variable', 'eventscripts_gg5'):
        eventscripts_gg5.removeFlag('notify')
        eventscripts_gg5.removeFlag('replicated')

    # Create the public variables
    eventscripts_gg.set(gungame_info('version'))
    eventscripts_gg.makepublic()
    eventscripts_gg5.set(gungame_info('version'))
    eventscripts_gg5.makepublic()

    # Update the Included/Custom Addon lists
    gungame_info('update')

    # Register !thanks command
    registerSayCommand(
        '!thanks', thanks, 'Displays a list of those involved' +
        'with development and testing of GunGame.')

    # Add gungame to sv_tags
    tags = set(str(sv_tags).split(','))
    tags.add('gungame')
    sv_tags.set(','.join(tags))

    # Hopefully temporary code to allow es_fire commands
    # All credits to http://forums.eventscripts.com/viewtopic.php?t=42620
    for userid in es.getUseridList():
        disable_auto_kick(userid)
예제 #13
0
def clientcmd_cmd(args):
   """ Provides an easy way to create client or say commands that require authorization to use """
   if len(args) > 1:
      arg0 = args[0].lower()
      # Creating commands
      if arg0 == 'create':
         if len(args) == 6:
            arg1 = args[1].lower()
            if arg1 in ('say', 'console'):
               permission = args[5].lower()
               if permission in flags:
                  if arg1 == 'say':
                     cmdlib.registerSayCommand(args[2].lower(), args[3], 'Permission-based say command', args[4], flags[permission])
                  else:
                     cmdlib.registerClientCommand(args[2].lower(), args[3], 'Permission-based client console command', args[4], flags[permission])
               else:
                  # Sort flags for output from most restricted to least restricted
                  sorted_flags = ', '.join(sorted(flags, key=lambda x: cmdlib.permissionToInteger(flags[x])))
                  es.dbgmsg(0, '"' + permission + '" is an invalid permission flag for clientcmd.\nAcceptable flags are: ' + sorted_flags)
            else:
               es.dbgmsg(0, 'Second parameter of clientcmd must be "say" or "console"')
         else:
            es.dbgmsg(0, 'Incorrect number of parameters given to clientcmd create (expected 6, got %s)\nSyntax: clientcmd create <say/console> <command name> <block to call> <capability name> <permission level>' % len(args))

      # Deleting commands
      elif arg0 == 'delete':
         if len(args) == 3:
            arg1 = args[1].lower()
            if arg1 == 'say':
               cmdlib.unregisterSayCommand(args[2])
            elif arg1 == 'console':
               cmdlib.unregisterClientCommand(args[2])
            else:
               es.dbgmsg(0, 'Second parameter of clientcmd must be "say" or "console"')
         else:
            es.dbgmsg(0, 'Incorrect number of parameters given to clientcmd delete (expected 3, got %s)\nSyntax: clientcmd delete <say/console> <command name>' % len(args))
      else:
         es.dbgmsg(0, 'First parameter of clientcmd must be "create" or "delete"')
   else:
      es.dbgmsg(0, 'clientcmd must have "create" or "delete" as the first argument and "say" or "console" as the second')
예제 #14
0
def server_cvar(event_var):
    cvar_name = event_var['cvarname']
    cvar_value = event_var['cvarvalue']

    # If the weapon order changed, get the new rtv_DisableLevel
    if cvar_name in ['gg_weapon_order_file', 'gg_weapon_order_sort_type']:
        global rtv_DisableLevel
        rtv_DisableLevel = (get_total_levels() *
                            gg_map_vote_rtv_levels_required / 100)

    # Register RTV commmands?
    if cvar_name == 'gg_map_vote_rtv':

        # Register RTV and nomination commands
        if int(cvar_value):
            registerSayCommand(str(gg_map_vote_rtv_command), rtv_cmd,
                               '' + 'RTV command.')
            registerSayCommand(str(gg_map_vote_nominate_command), nominate_cmd,
                               'Nominate command.')
        # Unregister RTV and nomination commands
        else:
            unregisterSayCommand(str(gg_map_vote_rtv_command))
            unregisterSayCommand(str(gg_map_vote_nominate_command))
예제 #15
0
def registerPlayerCmd():
    global player_command_backup

    # Get the current value
    gg_map_vote_player_command_current = str(gg_map_vote_player_command)

    # Is blank/disabled ?
    if gg_map_vote_player_command_current in ['', '0']:
        return

    # New command ?
    if gg_map_vote_player_command_current != player_command_backup:

        # Does the new command already exist?
        if int(es.exists('saycommand', gg_map_vote_player_command_current)):

            # Send error and stop
            raise ValueError('(%s) ' % gg_map_vote_player_command +
                             'is allready a registered command!')

        # Does the old command exist?
        if int(es.exists('saycommand', player_command_backup)):

            # Unregister old command
            unregisterSayCommand(player_command_backup)

    # Command was allready loaded ?
    if int(es.exists('saycommand', gg_map_vote_player_command_current)):
        return

    # Register new command
    registerSayCommand(
        gg_map_vote_player_command_current, voteSendcmd,
        'Allows players to vote for the next map. (gg_map_vote)')

    # Backup command
    player_command_backup = str(gg_map_vote_player_command)
예제 #16
0
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.')
예제 #17
0
def registerPlayerCmd():
    global player_command_backup

    # Get the current value
    gg_map_vote_player_command_current = str(gg_map_vote_player_command)

    # Is blank/disabled ?
    if gg_map_vote_player_command_current in ["", "0"]:
        return

    # New command ?
    if gg_map_vote_player_command_current != player_command_backup:

        # Does the new command already exist?
        if int(es.exists("saycommand", gg_map_vote_player_command_current)):

            # Send error and stop
            raise ValueError("(%s) " % gg_map_vote_player_command + "is allready a registered command!")

        # Does the old command exist?
        if int(es.exists("saycommand", player_command_backup)):

            # Unregister old command
            unregisterSayCommand(player_command_backup)

    # Command was allready loaded ?
    if int(es.exists("saycommand", gg_map_vote_player_command_current)):
        return

    # Register new command
    registerSayCommand(
        gg_map_vote_player_command_current, voteSendcmd, "Allows players to vote for the next map. (gg_map_vote)"
    )

    # Backup command
    player_command_backup = str(gg_map_vote_player_command)
예제 #18
0
def load():
    # Register command
    registerSayCommand('!top10', winner_menu_cmd, 'Displays a !top10 menu.')
    registerSayCommand('!winners', winner_menu_cmd, 'Displays a !top10 menu.')
    registerSayCommand('!top', winner_menu_cmd, 'Displays a !top10 menu.')
예제 #19
0
def load():
    # Register command
    registerSayCommand('!rank', rank_menu_cmd, 'Displays a !rank menu.')
예제 #20
0
def load():
    # Register command
    registerSayCommand('!score', score_menu_cmd, 'Displays a !score menu.')
예제 #21
0
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.")
예제 #22
0
def load():
    # Register !welcome
    registerSayCommand('!welcome', welcome, 'Displays a !welcome menu.')

    # Build the main gg_welcome popup
    buildPopups()
예제 #23
0
def load():
    # Register command
    registerSayCommand('!top10', winner_menu_cmd, 'Displays a !top10 menu.')
    registerSayCommand('!winners', winner_menu_cmd, 'Displays a !top10 menu.')
    registerSayCommand('!top', winner_menu_cmd, 'Displays a !top10 menu.')
예제 #24
0
def load():
    # Register command
    registerSayCommand('!weapons', weapons_menu_cmd,
                       'Displays a ' + '!weapons menu.')
예제 #25
0
def load():
    # Register command
    registerSayCommand('!weapons', weapons_menu_cmd, 'Displays a ' +
        '!weapons menu.')
예제 #26
0
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.") 
예제 #27
0
def clientcmd_cmd(args):
    """ Provides an easy way to create client or say commands that require authorization to use """
    if len(args) > 1:
        arg0 = args[0].lower()
        # Creating commands
        if arg0 == 'create':
            if len(args) == 6:
                arg1 = args[1].lower()
                if arg1 in ('say', 'console'):
                    permission = args[5].lower()
                    if permission in flags:
                        if arg1 == 'say':
                            cmdlib.registerSayCommand(
                                args[2].lower(), args[3],
                                'Permission-based say command', args[4],
                                flags[permission])
                        else:
                            cmdlib.registerClientCommand(
                                args[2].lower(), args[3],
                                'Permission-based client console command',
                                args[4], flags[permission])
                    else:
                        # Sort flags for output from most restricted to least restricted
                        sorted_flags = ', '.join(
                            sorted(flags,
                                   key=lambda x: cmdlib.permissionToInteger(
                                       flags[x])))
                        es.dbgmsg(
                            0, '"' + permission +
                            '" is an invalid permission flag for clientcmd.\nAcceptable flags are: '
                            + sorted_flags)
                else:
                    es.dbgmsg(
                        0,
                        'Second parameter of clientcmd must be "say" or "console"'
                    )
            else:
                es.dbgmsg(
                    0,
                    'Incorrect number of parameters given to clientcmd create (expected 6, got %s)\nSyntax: clientcmd create <say/console> <command name> <block to call> <capability name> <permission level>'
                    % len(args))

        # Deleting commands
        elif arg0 == 'delete':
            if len(args) == 3:
                arg1 = args[1].lower()
                if arg1 == 'say':
                    cmdlib.unregisterSayCommand(args[2])
                elif arg1 == 'console':
                    cmdlib.unregisterClientCommand(args[2])
                else:
                    es.dbgmsg(
                        0,
                        'Second parameter of clientcmd must be "say" or "console"'
                    )
            else:
                es.dbgmsg(
                    0,
                    'Incorrect number of parameters given to clientcmd delete (expected 3, got %s)\nSyntax: clientcmd delete <say/console> <command name>'
                    % len(args))
        else:
            es.dbgmsg(
                0, 'First parameter of clientcmd must be "create" or "delete"')
    else:
        es.dbgmsg(
            0,
            'clientcmd must have "create" or "delete" as the first argument and "say" or "console" as the second'
        )
예제 #28
0
def load():
    # Register !welcome
    registerSayCommand('!welcome', welcome, 'Displays a !welcome menu.')

    # Build the main gg_welcome popup
    buildPopups()
예제 #29
0
def load():
    # Register a bunch of command
    cmdlib.registerServerCommand("ut_burn", burn, "Burns a player")
    cmdlib.registerServerCommand("ut_extinguish", extinguish, "Extinguishes a player")
    cmdlib.registerServerCommand("ut_freeze", freeze, "Freezes a player")
    cmdlib.registerServerCommand("ut_unfreeze", unfreeze, "Unfreezes a player")
    cmdlib.registerServerCommand("ut_slay", slay, "Slays a player")
    cmdlib.registerServerCommand("ut_blind", blind, "Blinds a player")
    cmdlib.registerServerCommand("ut_noclip", noclip, "Noclips a player without sv_cheats")
    cmdlib.registerServerCommand("ut_unnoclip", unnoclip, "Unnoclips a player.")
    cmdlib.registerServerCommand("ut_slap", slap, "Slaps a player")
    cmdlib.registerServerCommand("ut_name", name, "Renames a player")
    
    # Register Say Commands
    cmdlib.registerSayCommand("!admin", telladmin, "Shows admins that's currently online")
    cmdlib.registerSayCommand("!admins", telladmin, "Shows admins that's currently online")
    cmdlib.registerSayCommand("!burn", sayburn, "Burns a player")
    cmdlib.registerSayCommand("!extinguish", sayextinguish, "Extinguishes a player")
    cmdlib.registerSayCommand("!freeze", sayfreeze, "Freezes a player")
    cmdlib.registerSayCommand("!unfreeze", sayunfreeze, "Unfreezes a player")
    cmdlib.registerSayCommand("!slay", sayslay, "Slays a player")
    cmdlib.registerSayCommand("!blind", sayblind, "Blinds a player")
    cmdlib.registerSayCommand("!noclip", saynoclip, "Noclips a player without sv_cheats")
    cmdlib.registerSayCommand("!unnoclip", sayunnoclip, "Unnoclips a player.")
    cmdlib.registerSayCommand("!slap", sayslap, "Slaps a player")
    cmdlib.registerSayCommand("!name", sayname, "Renames a player")
    
    # Register variable
    if es.exists("variable", "ut_announce") == 0:
        es.ServerVar("ut_announce", announcing)

    if es.exists("variable", "ut_displaydmg") == 0:
        es.ServerVar("ut_displaydmg", enableDmgDisplay)
        es.flags("add", "notify", "ut_displaydmg")

    if es.exists("variable", "ut_16k") == 0:
        es.ServerVar("ut_16k", enable16k)
        es.flags("add", "notify", "ut_16k")

    es.ServerVar("ut_version", info.version).makepublic()
예제 #30
0
def load():
    # Register command
    registerSayCommand('!score', score_menu_cmd, 'Displays a !score menu.')
예제 #31
0
def load():
    # Register command
    registerSayCommand('!rank', rank_menu_cmd, 'Displays a !rank menu.')