Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here
NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

You are here: Big Brother Bot ForumAdd-OnsPlugins Discussion (Moderator: MordyT)B3 plugin not working
Pages: [1]   Go Down
  Print  
Author Topic: B3 plugin not working  (Read 696 times) Bookmark and Share
Jr. Member
**
OS: Windows
Type: Renting Server with B3
Gameservers: CoD4
Posts: 24
Offline Offline
« on: March 19, 2011, 01:23:38 PM »

Ok so I made these commands for B3 and I cant seem to find out why they are not working. If you can help me, please post! Heres all the info:

b3.xml
Code:
<?xml version="1.0"?>
<configuration>
  <settings name="b3">
    <set name="parser">cod4</set>
    <set name="database">mysql://**USERNAME**:**PASSWORD**@isgclan.com/isgclan_b3</set>
    <set name="bot_name">B3</set>
    <set name="bot_prefix">^0(^2b3^0)^7:</set>
    <set name="time_format">%I:%M%p %Z %m/%d/%y</set>
    <set name="time_zone">CST</set>
    <set name="log_level">8</set>
    <set name="logfile">b3.log</set>
  </settings>
  <settings name="server">
    <set name="rcon_password">**PASSWORD**</set>
    <set name="port">28960</set>
    <set name="game_log">ftp://**USERNAME**:**PASSWORD**@184.154.47.140/184.154.47.140 port 28960/Mods/isg_jump/games_mp.log</set>
    <set name="public_ip">184.154.47.140</set>
    <set name="rcon_ip">184.154.47.140</set>
    <set name="punkbuster">off</set>
  </settings>
  <settings name="autodoc">
    <set name="type">html</set>
    <set name="maxlevel">100</set>
    <set name="destination">b3_doc.html</set>
  </settings>
  <settings name="messages">
    <set name="kicked_by">$clientname^7 was kicked by $adminname^7 $reason</set>
    <set name="kicked">$clientname^7 was kicked $reason</set>
    <set name="banned_by">$clientname^7 was banned by $adminname^7 $reason</set>
    <set name="banned">$clientname^7 was banned $reason</set>
    <set name="temp_banned_by">$clientname^7 was temp banned by $adminname^7 for $banduration^7 $reason</set>
    <set name="temp_banned">$clientname^7 was temp banned for $banduration^7 $reason</set>
    <set name="unbanned_by">$clientname^7 was un-banned by $adminname^7 $reason</set>
    <set name="unbanned">$clientname^7 was un-banned $reason</set>
  </settings>
  <settings name="plugins">
    <set name="external_dir">@b3/extplugins</set>
  </settings>
  <plugins>
    <plugin name="spamcontrol" config="@conf/plugin_spamcontrol.xml"/>
    <plugin name="admin" config="@conf/plugin_admin.xml"/>
    <plugin name="tk" config="@conf/plugin_tk.xml"/>
    <plugin name="stats" config="@conf/plugin_stats.xml"/>
    <plugin name="pingwatch" config="@conf/plugin_pingwatch.xml"/>
    <plugin name="status" config="@conf/plugin_status.xml"/>
    <plugin name="welcome" config="@conf/plugin_welcome.xml"/>
    <plugin name="punkbuster" config="@conf/plugin_punkbuster.xml"/>
    <plugin name="isg" config="@extplugins/conf/plugin_isg.xml"/>
  </plugins>
</configuration>

isg.py
Code:
__version__ = '0.12'
__author__  = 'Savior'

from b3.querybuilder import QueryBuilder
import b3, thread, time, string
import b3, re
import b3.events
# Import the necessary libaries you need here, for example, I need random for the randomization of answers part of it.
import random
#--------------------------------------------------------------------------------------------------
#This lot doesn't need to be changed for simple commands, it gets the admin plugin and registers commands.
class SaviorPlugin(b3.plugin.Plugin):
    _adminPlugin = None

    def startup(self):
      """\
      Initialize plugin settings
      """

   # get the admin plugin so we can register commands
      self._adminPlugin = self.console.getPlugin('admin')
      if not self._adminPlugin:
      # something is wrong, can't start without admin plugin
        self.error('Could not find admin plugin')
        return False
   
    # register our commands (you can ignore this bit)
      if 'commands' in self.config.sections():
        for cmd in self.config.options('commands'):
          level = self.config.get('commands', cmd)
          sp = cmd.split('-')
          alias = None
          if len(sp) == 2:
            cmd, alias = sp

          func = self.getCmd(cmd)
          if func:
            self._adminPlugin.registerCommand(self, cmd, level, func, alias)

      self.debug('Started')


    def getCmd(self, cmd):
      cmd = 'cmd_%s' % cmd
      if hasattr(self, cmd):
        func = getattr(self, cmd)
        return func

      return None
#--------------------------------------------------------------------
# Your commands go under here

    def cmd_give(self, data, client, cmd=None):
        """\
        <player> <gun> - Give a player a weapon/ammo
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False
        if not m[1]:
            client.message('^7Invalid parameters')
            return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('punish give::','%s','::','%s' % (sclient.cid, m[1]))
   
    def cmd_freeze(self, data, client, cmd=None):
        """\
        <player> - Freezes a selected player
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('punish freeze::','%s' % (sclient.cid))


    def cmd_kill(self, data, client, cmd=None):
        """\
        <player> - Kills a selected player
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
           client.message('^7Invalid parameters')
           return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('punish kill::','%s' % (sclient.cid))

    def cmd_spec(self, data, client, cmd=None):
        """\
        <player> - Force spectates a selected player
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('punish spec::%s' % (sclient.cid))
   
    def cmd_flash(self, data, client, cmd=None):
        """\
        <player> - Flashes a selected player
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('punish flash::%s' % (sclient.cid))
               
    def cmd_fastrestart(self, data, client, cmd=None):
        """\
        - Restarts the map quickly
        """
        self.console.write('fast_restart')
       
    def cmd_restartmap(self, data, client, cmd=None):
        """\
        Restart the current map.
        (You can safely use the command without the 'pa' at the beginning)
        """
        self.console.write('map_restart')
        return True
       
    def cmd_promote(self, data, client, cmd=None):
        """\
        <player> - Gives a player VIP
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('cj_promote %s' % (sclient.cid))

       
    def cmd_demote(self, data, client, cmd=None):
        """\
        <player> - Demotes a VIP/Soviet
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False
        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('cj_demote %s' % (sclient.cid))
       
    def cmd_soviet(self, data, client, cmd=None):
        """\
        <player> - Promotes a player to Soviet
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False

        sclient = self._adminPlugin.findClientPrompt(m[0], client)
        if sclient:
           self.console.write('cj_soviet_promote %s' % (sclient.cid))

    def cmd_force(self, data, client, cmd=None):
        """\
        - Forces a current vote
        """
        self.console.write('openscriptmenu cjvote cjforce')

    def cmd_cancel(self, data, client, cmd=None):
        """\
        - Cancels a current vote
        """
        self.console.write('openscriptmenu cjvote cjcancel')

    def cmd_take(self, data, client, cmd=None):
        """\
        <weapon> - Gets a weapon
        """
        if not data:
           client.message('^7Invalid or missing data, try !help take')
           return False
        else:
           # are we still here? Let's write it to console
           self.console.setCvar( 'openscriptmenu mod ','%s' % (m))

           return True


    def cmd_devmap(self, data, client, cmd=None):
        """\
        <map> - Changes the map into dev mode
        """
        if not data:
           client.message('^7Invalid or missing data, try !help map')
           return False
        else:
           # are we still here? Let's write it to console
           self.console.setCvar( 'devmap ','%s' % (m))

           return True

    def cmd_adminsay(self, data, client, cmd=None):
        """\
        <message> - Puts a message on the screen
        """
        if not data:
           client.message('^7Invalid or missing data, try !help take')
           return False
        else:
           # are we still here? Let's write it to console
           self.console.setCvar( 'cj_message ^2ADMIN:^7','%s' % (m))

           return True

plugin_isg.xml
Code:
<configuration plugin="isg.py">
   <settings name="commands">
      <set name="give">80</set>
      <set name="freeze">80</set>
      <set name="kill">80</set>
      <set name="spec">80</set>
      <set name="flash">80</set>
      <set name="fastrestart">80</set>
      <set name="restartmap">80</set>
      <set name="promote">60</set>
      <set name="demote">60</set>
      <set name="soviet">80</set>
      <set name="force">80</set>
      <set name="cancel">80</set>
      <set name="take">20</set>
      <set name="map">80</set>
      <set name="devmap">80</set>
      <set name="adminsay">80</set>
    </settings>
</configuration>

ERROR:
Code:
110319 14:11:57 BOT    Loading Plugin #9 isg [C:\Documents and Settings\Daniel Metcalf\Desktop\b3\extplugins\conf\plugin_isg.xml]
110319 14:11:57 INFO Could not load built in plugin isg (No module named isg)
110319 14:11:58 INFO trying external plugin directory : C:\Documents and Settings\Daniel Metcalf\Desktop\b3\extplugins
110319 14:11:58 CRITICAL Error loading plugin: 'module' object has no attribute 'IsgPlugin'
Traceback (most recent call last):
  File "b3\parser.pyo", line 536, in loadPlugins
AttributeError: 'module' object has no attribute 'IsgPlugin'
Logged

Beta Testers
*
OS: Windows
Type: Owner dedicated server(s)
Gameservers: alterIW
Posts: 652
Offline Offline
WWW
« Reply #1 on: March 19, 2011, 02:10:42 PM »

Ok so I made these commands for B3 and I cant seem to find out why they are not working. If you can help me, please post! Heres all the info:

Code:
110319 14:11:57 BOT    Loading Plugin #9 isg [C:\Documents and Settings\Daniel Metcalf\Desktop\b3\extplugins\conf\plugin_isg.xml]
110319 14:11:57 INFO Could not load built in plugin isg (No module named isg)
110319 14:11:58 INFO trying external plugin directory : C:\Documents and Settings\Daniel Metcalf\Desktop\b3\extplugins
110319 14:11:58 CRITICAL Error loading plugin: 'module' object has no attribute 'IsgPlugin'
Traceback (most recent call last):
  File "b3\parser.pyo", line 536, in loadPlugins
AttributeError: 'module' object has no attribute 'IsgPlugin'

This line in your b3.xml:

   <plugin name="isg" config="@extplugins/conf/plugin_isg.xml"/>

Do you have the plugin_isg.xml in your extplugins/conf folder and the isg.py file in your extplugins folder? That's where the error is.
Logged
Jr. Member
**
OS: Windows
Type: Renting Server with B3
Gameservers: CoD4
Posts: 24
Offline Offline
« Reply #2 on: March 19, 2011, 02:13:55 PM »

Yes i defiantly do.
Logged
Sr. Member
****
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4
Posts: 180
Offline Offline
WWW
« Reply #3 on: March 19, 2011, 02:56:54 PM »

change
Code:
class SaviorPlugin(b3.plugin.Plugin):

to

Code:
class IsgPlugin(b3.plugin.Plugin):
Logged

Jr. Member
**
OS: Windows
Type: Renting Server with B3
Gameservers: CoD4
Posts: 24
Offline Offline
« Reply #4 on: March 19, 2011, 07:25:18 PM »

Thanks Spoon, Btw I am trying to make it so the !take command to write as if they were writing it themselves in the console(ex: I was a member on my server I would have to type /openscriptmenu mod deagle to get the deagle, i want to make it so its just like that)
Logged
Sr. Member
****
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4
Posts: 180
Offline Offline
WWW
« Reply #5 on: March 20, 2011, 01:46:38 PM »

"openscriptmenu mod" needs to be done client side, B3 only sends rcon commands this command wont work.
Logged

Tags: verify b3 plugin 
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal