Exemplo n.º 1
0
def unload():
    # Delete the popup if it exists
    if popuplib.exists('ggLevelMenu'):
        popuplib.unsendname('ggLevelMenu', getUseridList('#human'))
        popuplib.delete('ggLevelMenu')

    # Unregister commands
    unregisterSayCommand('!level')
Exemplo n.º 2
0
def unload():
    # Unregister !welcome
    unregisterSayCommand('!welcome')

    # Clean up existing popups
    if popuplib.exists('gg_welcome'):
        popuplib.delete('gg_welcome')
    if popuplib.exists('gg_welcome_include'):
        popuplib.delete('gg_welcome_include')
    if popuplib.exists('gg_welcome_custom'):
        popuplib.delete('gg_welcome_custom')
Exemplo n.º 3
0
def unload():
    # Unregister !welcome
    unregisterSayCommand('!welcome')

    # Clean up existing popups
    if popuplib.exists('gg_welcome'):
        popuplib.delete('gg_welcome')
    if popuplib.exists('gg_welcome_include'):
        popuplib.delete('gg_welcome_include')
    if popuplib.exists('gg_welcome_custom'):
        popuplib.delete('gg_welcome_custom')
Exemplo n.º 4
0
def unload():
    """
    Executed when the script unloads. Manually remove all instance
    of the singletons so the deconstructor is called on each one
    """
    sourcerpg.addons.removeAddon(addonName)

    del globals()['admin']
    del globals()['popup']
    if popuplib.exists("sourcerpg_confirmDeleteDatabase"):
        popuplib.delete("sourcerpg_confirmDeleteDatabase")

    cmdlib.unregisterSayCommand("rpg_admin")
    cmdlib.unregisterSayCommand("rpgadmin")
    cmdlib.unregisterClientCommand("rpgaddxp")
    cmdlib.unregisterClientCommand("rpgaddlevels")
    cmdlib.unregisterClientCommand("rpgaddcredits")
Exemplo n.º 5
0
def unload():
    """
    Executed when the script unloads. Manually remove all instance
    of the singletons so the deconstructor is called on each one
    """
    sourcerpg.addons.removeAddon(addonName)
    
    del globals()['admin']
    del globals()['popup']
    if popuplib.exists("sourcerpg_confirmDeleteDatabase"):
        popuplib.delete("sourcerpg_confirmDeleteDatabase")
    
    cmdlib.unregisterSayCommand("rpg_admin")
    cmdlib.unregisterSayCommand("rpgadmin")
    cmdlib.unregisterClientCommand("rpgaddxp")
    cmdlib.unregisterClientCommand("rpgaddlevels")
    cmdlib.unregisterClientCommand("rpgaddcredits")
Exemplo n.º 6
0
def unload():
    # Remove gungame from sv_tags
    tags = set(str(sv_tags).split(','))
    tags.discard('gungame')
    sv_tags.set(','.join(tags))

    # Remove the public variables
    eventscripts_gg.removeFlag('notify')
    eventscripts_gg.removeFlag('replicated')
    eventscripts_gg5.removeFlag('notify')
    eventscripts_gg5.removeFlag('replicated')

    # Unregister server_cvar for core.weapons
    WeaponOrderManager().unregister()

    # Unregister events
    unload_events()

    # Unload Menus
    MenuManager().unload_menus()

    # Unload all sub-addons
    AddonManager().unload_all_addons()

    # Unload translations
    unload_translation('gungame', 'gungame')

    # Remove all player instances
    _PlayerContainer().clear()

    # Close the database
    Database().close()

    # Unload configs (removes flags from CVARs)
    unload_configs()

    # Enable Buyzones
    es.server.queuecmd('es_xfire %s func_buyzone Enable' % es.getuserid())

    # Fire gg_unload event
    GG_Unload().fire()

    # Unregister !thanks command
    unregisterSayCommand('!thanks')
Exemplo n.º 7
0
def unload():
    # Remove gungame from sv_tags
    tags = set(str(sv_tags).split(','))
    tags.discard('gungame')
    sv_tags.set(','.join(tags))

    # Remove the public variables
    eventscripts_gg.removeFlag('notify')
    eventscripts_gg.removeFlag('replicated')
    eventscripts_gg5.removeFlag('notify')
    eventscripts_gg5.removeFlag('replicated')

    # Unregister server_cvar for core.weapons
    WeaponOrderManager().unregister()

    # Unregister events
    unload_events()

    # Unload Menus
    MenuManager().unload_menus()

    # Unload all sub-addons
    AddonManager().unload_all_addons()

    # Unload translations
    unload_translation('gungame', 'gungame')

    # Remove all player instances
    _PlayerContainer().clear()

    # Close the database
    Database().close()

    # Unload configs (removes flags from CVARs)
    unload_configs()

    # Enable Buyzones
    es.server.queuecmd('es_xfire %s func_buyzone Enable' % es.getuserid())

    # Fire gg_unload event
    GG_Unload().fire()

    # Unregister !thanks command
    unregisterSayCommand('!thanks')
Exemplo n.º 8
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))
Exemplo n.º 9
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')
Exemplo n.º 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))
Exemplo n.º 11
0
def unload():
    # Unregister say commands
    unregisterSayCommand(str(gg_map_vote_player_command))
    unregisterSayCommand(str(gg_map_vote_rtv_command))
    unregisterSayCommand(str(gg_map_vote_nominate_command))

    eventscripts_maphandler.set(eventscripts_maphandler_backup)

    cleanVote()
Exemplo n.º 12
0
def unload():
    # Unregister say commands
    unregisterSayCommand(str(gg_map_vote_player_command))
    unregisterSayCommand(str(gg_map_vote_rtv_command))
    unregisterSayCommand(str(gg_map_vote_nominate_command))

    eventscripts_maphandler.set(eventscripts_maphandler_backup)

    cleanVote()
Exemplo n.º 13
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)
Exemplo n.º 14
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)
Exemplo n.º 15
0
def unload():
    # Unregister commands
    unregisterSayCommand('!top10')
    unregisterSayCommand('!top')
    unregisterSayCommand('!winners')
Exemplo n.º 16
0
def unload():
    # Unregister commands
    unregisterSayCommand('!rank')
Exemplo n.º 17
0
def unload():
    cmdlib.unregisterServerCommand("ut_burn")
    cmdlib.unregisterServerCommand("ut_extinguish")
    cmdlib.unregisterServerCommand("ut_freeze")
    cmdlib.unregisterServerCommand("ut_unfreeze")
    cmdlib.unregisterServerCommand("ut_slay")
    cmdlib.unregisterServerCommand("ut_blind")
    cmdlib.unregisterServerCommand("ut_noclip")
    cmdlib.unregisterServerCommand("ut_unnoclip")
    cmdlib.unregisterServerCommand("ut_slap")
    cmdlib.unregisterServerCommand("ut_name")

    cmdlib.unregisterSayCommand("!burn")
    cmdlib.unregisterSayCommand("!extinguish")
    cmdlib.unregisterSayCommand("!freeze")
    cmdlib.unregisterSayCommand("!unfreeze")
    cmdlib.unregisterSayCommand("!slay")
    cmdlib.unregisterSayCommand("!blind")
    cmdlib.unregisterSayCommand("!noclip")
    cmdlib.unregisterSayCommand("!unnoclip")
    cmdlib.unregisterSayCommand("!slap")
    cmdlib.unregisterSayCommand("!name")

    cmdlib.unregisterSayCommand("!admin")
    cmdlib.unregisterSayCommand("!admins")
Exemplo n.º 18
0
def unload():
    # Unregister commands
    unregisterSayCommand('!score')
Exemplo n.º 19
0
def unload():
    es.dbgmsg(0, "[SH] UnLoading...")
    es.doblock('corelib/noisy_off')
    es.unload('superhero/heroes')
    es.unload('superhero/admins')
    helpbox.delete()
    commandlist.delete()
    cmdlib.unregisterSayCommand('/myheroes')
    cmdlib.unregisterSayCommand('/showmenu')
    cmdlib.unregisterSayCommand('/showxp')
    cmdlib.unregisterSayCommand('/drop')
    cmdlib.unregisterSayCommand('/commandlist')
    cmdlib.unregisterSayCommand('/help')
    cmdlib.unregisterSayCommand('/buyxp')
    cmdlib.unregisterSayCommand('/clearpowers')
    cmdlib.unregisterSayCommand('/herolist')
    cmdlib.unregisterSayCommand('/playerinfo')
    cmdlib.unregisterSayCommand('/sh')
    cmdlib.unregisterSayCommand('/shmenu')
    cmdlib.unregisterClientCommand('+power1')
    cmdlib.unregisterClientCommand('+power2')
    cmdlib.unregisterClientCommand('+power3')
    cmdlib.unregisterClientCommand('-power1')
    cmdlib.unregisterClientCommand('-power2')
    cmdlib.unregisterClientCommand('-power3')
    connection.commit()  # Commit changes to table
    connection.close()  # Close our connection
    es.dbgmsg(0, "[SH] Unloading Done.")
Exemplo n.º 20
0
def unload():
    # Unregister commands
    unregisterSayCommand('!top10')
    unregisterSayCommand('!top')
    unregisterSayCommand('!winners')
Exemplo n.º 21
0
def unload():
    gamethread.cancelDelayed('bomb_timer')

    cmdlib.unregisterSayCommand('!bombtimer')

    es.msg('#multi', '#green[BombTimer] #defaultUnloaded')
Exemplo n.º 22
0
def unload():
    # Unregister commands
    unregisterSayCommand('!weapons')
Exemplo n.º 23
0
def unload():
    gamethread.cancelDelayed('bomb_timer')

    cmdlib.unregisterSayCommand('!bombtimer')

    es.msg('#multi', '#green[BombTimer] #defaultUnloaded')
Exemplo n.º 24
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'
        )
Exemplo n.º 25
0
def unload():
    es.dbgmsg(0, "[SH] UnLoading...")
    es.doblock('corelib/noisy_off')
    es.unload('superhero/heroes')
    es.unload('superhero/admins')
    helpbox.delete()
    commandlist.delete()
    cmdlib.unregisterSayCommand('/myheroes')
    cmdlib.unregisterSayCommand('/showmenu')
    cmdlib.unregisterSayCommand('/showxp')
    cmdlib.unregisterSayCommand('/drop')
    cmdlib.unregisterSayCommand('/commandlist')
    cmdlib.unregisterSayCommand('/help')
    cmdlib.unregisterSayCommand('/buyxp')
    cmdlib.unregisterSayCommand('/clearpowers')
    cmdlib.unregisterSayCommand('/herolist')
    cmdlib.unregisterSayCommand('/playerinfo')
    cmdlib.unregisterSayCommand('/sh')
    cmdlib.unregisterSayCommand('/shmenu')
    cmdlib.unregisterClientCommand('+power1')
    cmdlib.unregisterClientCommand('+power2')
    cmdlib.unregisterClientCommand('+power3')
    cmdlib.unregisterClientCommand('-power1')
    cmdlib.unregisterClientCommand('-power2')
    cmdlib.unregisterClientCommand('-power3')
    connection.commit() # Commit changes to table
    connection.close() # Close our connection
    es.dbgmsg(0, "[SH] Unloading Done.") 
Exemplo n.º 26
0
def unload():
    if lmv['command']:
        cmdlib.unregisterSayCommand(lmv['command'])
        cmdlib.unregisterClientCommand(lmv['command'])
    mapVote.cancelDelays()
Exemplo n.º 27
0
def unload():
    # Unregister commands
    unregisterSayCommand('!rank')
Exemplo n.º 28
0
def unload():
    cmdlib.unregisterSayCommand('/sh_admin')
    cmdlib.unregisterSayCommand('/shadmin')
    connection.commit()
    connection.close()
Exemplo n.º 29
0
def unload():
    # Unregister commands
    unregisterSayCommand('!score')
Exemplo n.º 30
0
def unload():
    # Unregister commands
    unregisterSayCommand('!weapons')