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
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
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
<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>