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)problem with forceteam plugin
Pages: [1]   Go Down
  Print  
Author Topic: problem with forceteam plugin  (Read 439 times) Bookmark and Share
Jr. Member
**
OS: Linux
Type: Renting Server, no B3
Gameservers: Black Ops
Posts: 29
Offline Offline
« on: August 23, 2010, 11:07:09 AM »

im trying to enable forceteam plugin with a small modification like forcespec and i get an error and it restarts b3. can you please show me the errors of my way.

log file
Code:
100823 13:57:24 DEBUG AdminPlugin: Command "advrem (None)" registered with cmd_advrem for level (100, 100)
100823 13:57:24 BOT    Starting Plugin status
100823 13:57:24 BOT    Starting Plugin welcome
100823 13:57:24 DEBUG Register Event: Client Authenticated: WelcomePlugin
100823 13:57:24 BOT    Starting Plugin punkbuster
100823 13:57:24 DEBUG AdminPlugin: Command "pbss (None)" registered with cmd_pbss for level (20, 100)
100823 13:57:24 DEBUG AdminPlugin: Command "pbbuildbans (None)" registered with cmd_pbbuildbans for level (80, 100)
100823 13:57:24 BOT    Starting Plugin forceteam
100823 13:57:24 INFO STDOUT Error: ForceteamPlugin instance has no attribute 'cmd_forcespec'
  File "C:\games\ets\cod4\b3\b3\__init__.py", line 167, in start
    console.start()
  File "C:\games\ets\cod4\b3\b3\parser.py", line 356, in start
    self.startPlugins()
  File "C:\games\ets\cod4\b3\b3\parser.py", line 577, in startPlugins
    p.onStartup()
  File "C:\games\ets\cod4\b3\b3\extplugins\forceteam.py", line 60, in onStartup
    self._adminPlugin.registerCommand(self, 'forceteam', 'forcespec', self.forceteamlevel, self.cmd_forceteam, self.cmd_forcespec)

100823 13:57:24 INFO STDOUT

100823 13:57:24 INFO STDOUT 223
100823 13:57:24 INFO STDOUT

100823 13:57:24 BOT    Shutting down...
100823 13:57:24 VERBOSE AdvPlugin: Warning: No handle func for AdvPlugin
100823 13:57:24 INFO StatusPlugin: B3 stop/exit.. updating status
100823 13:57:24 DEBUG StatusPlugin: Writing XML status to C:\Documents and Settings\Default User/status.xml
100823 13:57:24 VERBOSE PunkbusterPlugin: Warning: No handle func for PunkbusterPlugin
100823 13:57:24 INFO PublistPlugin: Sending shutdown info to B3 master
100823 13:57:25 VERBOSE ForceteamPlugin: Warning: No handle func for ForceteamPlugin
100823 13:57:25 BOT    Shutting down database connections...

forcespec.py
Code: python
from b3 import clients

class ForceteamPlugin(b3.plugin.Plugin):

   def onLoadConfig(self):
       try:
           self.forceteamlevel = self.config.getint('settings', 'forceteamlevel')
       except:
           self.forceteamlevel = 40
           self.debug('Using default value (%i) for settings::forceteamlevel', self.forceteamlevel)
       return


   def onStartup(self):
       # Load admin plugin, we might need it
       self._adminPlugin = self.console.getPlugin('admin')
       if not self._adminPlugin:
           return False

       self._adminPlugin.registerCommand(self, 'forceteam', 'forcespec', self.forceteamlevel, self.cmd_forceteam, self.cmd_forcespec)

   def cmd_forceteam(self, data, client=None, cmd=None):
       """\
        - force a player into a team or spectator
       """
       data = string.split(data)
       if len(data) < 2:
           client.message('^7Invalid parameters : !forceteam ')
           return

       m = self._adminPlugin.parseUserCmd(data[0])
       if not m:
           client.message('^7Invalid parameters : you must supply a valid name or id and a team !')
           return False

       cid, keyword = m
       team = data[1]
       
       try:
           self.console.write(self.console.getCommand('moveToTeam', cid=client, team='spectator'))
       except:
           self.console.write('forceteam %s %s' % (cid, team))

       return None

def cmd_forcespec(self, data, client=None, cmd=None):
       
m = self._adminPlugin.parseUserCmd(data)
       if not m:
           client.message('^7Invalid parameters : you must supply a valid name or id !')
           return False
       
       else:
cid, keyword = m
self.console.write(self.console.getCommand('moveToTeam', cid=client, team='spectator'))



forceteam.xml
Code:

<configuration plugin="forceteam">
<settings name="settings">

<!-- !forceteam : minimum level necessary to be able to switch a player to a team <red/blue/spectator> -->
<set name="forceteamlevel">40</set>

</settings>
</configuration>
« Last Edit: August 23, 2010, 11:37:12 AM by Courgette » Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #1 on: August 23, 2010, 02:08:58 PM »

Instead of :

Code: python
self._adminPlugin.registerCommand(self, 'forceteam', 'forcespec', self.forceteamlevel, self.cmd_forceteam, self.cmd_forcespec)

Do :

Code: python
self._adminPlugin.registerCommand(self, 'forceteam', self.forceteamlevel, self.cmd_forceteam)
self._adminPlugin.registerCommand(self, 'forcespec', self.forceteamlevel, self.cmd_forcespec)

This should fix your problem.
Logged
Jr. Member
**
OS: Linux
Type: Renting Server, no B3
Gameservers: Black Ops
Posts: 29
Offline Offline
« Reply #2 on: August 23, 2010, 04:13:11 PM »

hmm also how would i edit the whole script so it would only use one command and that is the forcespec 1 so it wont ask for anything else.
game is cod4

!forcespec name

i have a problem in this general area

Code:
def cmd_forcespec(self, data, client=None, cmd=None): 
         
        m = self._adminPlugin.parseUserCmd(data) 
       if not m: 
           client.message('^7Invalid parameters : you must supply a valid name or id !') 
           return False 
         
       else: 
            cid, keyword = m 
            self.console.write(self.console.getCommand('moveToTeam', cid=client, team='spectator')) 
 
Logged
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #3 on: August 27, 2010, 10:46:11 AM »

You must split the data first :

Code: python
         data = string.split(data)  
       if len(data) < 2:  

And about using a name instead of an id, no sorry, for the moment it's not supported.
Logged
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #4 on: August 28, 2010, 04:18:48 AM »

Forceteam updated to v0.3, fixed the name recognition bug and implemented !forcespec as you required. Now you can use a name instead of an id.

For download and more infos :
http://www.bigbrotherbot.net/forums/releases/forceteam/
Logged
Jr. Member
**
OS: Linux
Type: Renting Server, no B3
Gameservers: Black Ops
Posts: 29
Offline Offline
« Reply #5 on: August 29, 2010, 04:17:49 PM »

Cheesy tx a lot!!!
Logged
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal