ModManager for BF2CCD

Discussion in 'BF2CC' started by SharK, Dec 4, 2015.

  1. SharK

    SharK Member

    === What is ModManager===
    ModManager is server framework that enables players, admins and developers
    to get the most out of BattleField servers.

    It enables custom admin modules to be easily developed to enhance the
    abilities of the server.

    Additional or updated modules are then easily installed and loaded without
    even restarting your server, reducing down time and keeping players happy.

    === Getting ModManager ===
    Download the latest version of ModManager here: - link dead, file add #post-10733
    Latest version: ModManager-v2.2c

    === Installing ModManager===
    To install just unzip into your servers directory

    === Running ModManager ===
    Their are two ways you run ModManager depending on which package
    you have.

    Package #1 (Quick)
    If you dont have in your bf2/admin directory
    no further action is needed.

    Package #2 (Safe)
    If you have a in your bf2/admin directory
    you will need to change your server config to to use it as
    the admin script e.g.
    sv.adminScript "modmanager"
    If you are using the Windows server launcher change
    AdminScript to be "modmanager" ( without the quotes )

    === Installing new modules ===
    This couldnt be simpler just extract the new module so that
    it sits in the "admin/modules" directory, add
    modmanager.loadModule "<new module>"
    To your modmanager.con and away you go.

    === Enhanced Rcon ===
    ModManager includes a much enhanced rcon which can easily be
    extended by addition modules. Due to this flexibility different
    command will be available depending on which modules you have
    loaded. For a full list of available commands you the built in
    help system once you are logged into rcon.

    ==== Included modules ====
    1) mm_announcer
    Provides "On Join" and Time based messaging
    Note: Messages on join are currently to all due
    host.sgl_sendTextMessage( playerid, channelid, typeid, text, flags )
    being broken for channelid 14 ( Player )

    2) mm_autobalance
    A direct conversion of the default Auto Balance script
    with the addition of tuneables to disable balancing of
    squad members, squad leader and the commander

    3) mm_bf2cc
    Provides the server side method to support BF2CC see for more info on this excellent
    Rcon Client.

    4) mm_kicker
    Provides, ping ( high and low ), idle and bad word based kick and

    5) mm_logger
    Provides default file based logging

    6) mm_reserver
    Provides slot reservation based on player profileids

    7) mm_rcon
    A major update to the standard RCON including context
    sensitive help, a fully extensible framework, enhanced error
    detection as well as a number of other fixes.

    8) mm_sample
    A basic sample module

    9) mm_tk_punish
    A direct conversion of the default Team Kill script

    10) mm_clanmatch *** DEPRICATED ***
    Does nothing, please use mm_autobalance instead

    11) mm_banmanager
    Manages bans maintaining the following information:
    * Player Nick
    * Player key
    * Player IP
    * Datetime of ban
    * Ban Period
    * Ban Type
    * Banned By
    This is also multi server compatible so bans will no longer be lost
    if you are running multiple servers from the same directory.

    ==== Developing modules ====
    Developing modules for ModManager is easy. A good starting point
    is contained in the modules/mm_sample directory. In addition to
    this the core modules that ship with ModManager will help you
    with examples of how almost everything works.

    The ModManager API below is the listing of the methods ModManager
    provides to enable you to develop BF2 modules quickly and easily.

    Extending rcon in modules is simple the module just needs
    to register its additional command handlers using

    ==== Notes ====
    * If you register handlers you should do so in the init() method
    and call the converse method in shutdown()
    * Due to the lack of a host.unregisterHandler( method ) modules
    which use host.registerHandler( method ) should include a local
    state variable which masks the call of these methods if the module
    has been shutdown. See mm_announcer for an example of this.
    * If your module registers for updates the update() method should
    be clean an quick as this method will be called VERY often. Failure
    to do so may cause significant performance penalties ( high CPU
    load and lag ).
    * module rcon commands should be added via the sub command interface
    see mm_sample for an example of this
    * You are encouraged to use the helper methods in mm_utils to
    provide a consistent interface to kick and ban. Using these methods
    will ensure your code takes advantage of any enhancements that may
    become available in BF2 for this area in the future
    e.g. Player dialog messages.
    * All modules must provide a class level mm_load method which returns
    the module object.
    * Modules which support reload ( __supports_reload__ = True ) must
    provide an object level shutdown method.
    * It is not guaranteed that shutdown will be called on modules when
    the server exits.

    ==== Debugging ====
    Debugging support in ModManager is enabled using
    modmanager.debugEnable 1
    modmanager.debugFile "modmanager_debug.log"
    modmanager.logLevel 10
    This will create a log file in the servers main directory
    which will capture any error / info that is generate by your

    ===== State Vars =====
    # The previous game state before the current one

    # The current game state

    # True if the current game state is bf2.GameState.Playing false otherwise

    # True if the current round has started i.e. state is bf2.GameState.Playing
    # and there are enough players to begin False otherwise

    ===== Configuration methods =====
    # Returns the configuration path

    # Return the config filename.

    # Return the modules configuration, adding any missing default values.
    mm.getModuleConfig( moduleDefaults={} )

    # Set the calling modules parameter.
    mm.setParam( key, value )

    # Add a value to the the calling modules parameters.
    mm.addParam( key, value )

    # Remove one of the calling modules parameter values.
    mm.removeParam( key, idx )

    # Return the calling modules parameter.
    mm.getParam( key )

    # Set the rcon modules parameter.
    mm.setRconParam( key, value )

    Return the rcon modules parameter.
    mm.getRconParam( key )

    # Save the running config

    ===== Logging methods =====
    # Log the message at the given debug level.
    mm.debug( level, msg )

    # Log the message at the info level. msg )

    # Log the message at the warn level.
    mm.warn( msg )

    # Log the message at the error level.
    mm.error( msg, traceback=False )

    # Returns a formatted string of the exception.
    mm.exceptionString( self )

    ===== Rcon methods =====
    # Register a new rcon function hander.
    mm.registerRconCmdHandler( name, details )

    # Unregister an existing rcon function handler.
    mm.unregisterRconCmdHandler( name )

    # Register a new rcon connect hander.
    mm.registerRconConnectHandler( func )

    # Unregister an existing rcon connect handler.
    mm.unregisterRconConnectHandler( func )

    # Register a new rcon disconnect hander.
    mm.registerRconDisconnectHandler( func )

    # Unregister an existing rcon disconnect handler.
    mm.unregisterRconDisconnectHandler( func )

    # Register a new rcon auth hander.
    # auth_func should return a number indicating the authentication level
    # check_func should return True or False indicating if the user is permitted
    # to use the passed in rcon method
    mm.registerRconAuthHandler( self, auth_func, check_func )

    # Unregister an existing rcon auth handler.
    mm.unregisterRconAuthHandler( func )

    # Register a new rcon authed hander.
    mm.registerRconAuthedHandler( func )

    # Unregister an existing rcon auth handler.
    mm.unregisterRconAuthedHandler( func )

    ===== Status methods =====
    # Return how long a round has been running for.
    # Takes into account start delay and any pauses.

    # Return how long a round has left to play.
    # Returns 0 if there is no time limit or the round hasn't started

    ===== Ban Manager methods =====
    # Return the ban manager handle

    ===== Update methods =====
    # Requests updates.
    mm.registerUpdates( requestor )

    # Cancel request for updates.
    mm.unregisterUpdates( requestor )

    ==== mm_utils methods ====
    # Return the name of the status
    status_name( status )

    # Return the number or None if invalid.
    mm_utils.get_int( ctx, string, desc='number' )

    # Kick a player with a reason
    mm_utils.kick_player( player, msg='You are being kicked (Unknown reason)', delay=5, kick_type=KickBanType.rcon )

    # Kick a player
    mm_utils.kick_player_now( player, kick_type=None )

    # Ban a player for a given period with a reason ( ** Depricated use mm.banPlayer(..) )
    mm_utils.ban_player( player, msg='You are being banned (Unknown reason)', period=None, delay=5, ban_type=KickBanType.rcon )

    # Ban a player ( ** Depricated use mm.banPlayerNow(..) )
    mm_utils.ban_player_now( player, ban_type=None )

    # Sends a message to a player on the server
    # Note: This currently sends to the entire server as the underlying
    # API is broken in this respect.
    mm_utils.msg_player( playerid, msg )

    # Sends a message to all players on the server
    mm_utils.msg_server( msg )

    # Execute a modules sub command
    mm_utils.exec_subcmd( mm, subcmds, ctx, cmd )

    # Return the name of the calling module
    mm_utils.caller_module( level=2 )

    # Return the name for the given function.
    mm_utils.method_name( func )

    # Split the <str> using <on> returning a list with exactly <want> members.
    mm_utils.lsplit( str, on, want, default='' )

    # Find a player by cdkeyhash.
    mm_utils.get_player_by_cd_key_hash( cdkeyhash )

    # Determine the players CDKey hash.
    mm_utils.get_cd_key_hash( player )

    Attached Files:

    Last edited: May 9, 2018
  2. SharK

    SharK Member

    part 2

    Attached Files:

  3. SharK

    SharK Member

    part 3

    Attached Files:

    TheBassFlow likes this.
  4. SharK

    SharK Member

    part 4

    Attached Files:

    exemaco and Vibianchi like this.
  5. Vibianchi

    Vibianchi New Member

    Very good!

Share This Page