Promod admin plugin for B3
Featured Replies
Сейчас на странице 0
- Нет пользователей, просматривающих эту страницу
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Используя этот сайт, вы соглашаетесь Условия использования.
Some people kept asking me how to change promod_mode on a server. So, I just added those commands to b3, through this plugin.
Although some commands might not be working as of now, I've included all known promod commands, in case they ever get working.
I've also include commands for map_restart (!promodmr) and fast_restart (!promodfr) since those commands are commonly used by promod server admins.
I'll also remind you that the bug about the menu not showing up when you connect to a server running promod can be fixed with a map_restart (that's mostly why I added map_restart, and not just fast_restart)
If you need other commands, you should read this topic aswell -> viewtopic.php?f=17&t=17663
Anyway, let's get done with this. Here's how to add this plugin to b3:
Add this line to your promod server's "b3.xml": (remember that this line has to be added on the plugins section, somewhere after admin plugin loads)
Now save this code as "Promodadmin.py", on b3 "extplugins" folder:
# # Promod Admin Plugin for BigBrotherBot(B3) (www.bigbrotherbot.com) # # The purpose of this plugin is to add Promod specific commands to b3 # # this plugin is based on Master_Jochen's "masteradmin" plugin __version__ = '1.0' __author__ = 'Paulofonta' #let's suppose that I can code... lol import b3, re, time import b3.events #-------------- done by xlr8or---------------------------------------------------------------------------- class PromodadminPlugin(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 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 def onEvent(self, event): """\ Handle intercepted events """ # Commands implementation - done by Paulofonta def cmd_promodmr(self, data, client, cmd=None): self.console.say('^2Map will restart upon admin request, ^1in 5') time.sleep(1) self.console.say('^1 4') time.sleep(1) self.console.say('^1 3') time.sleep(1) self.console.say('^1 2') time.sleep(1) self.console.say('^1 1') time.sleep(1) self.console.write('map_restart') return True def cmd_promodfr(self, data, client, cmd=None): self.console.say('^2Fast restart upon admin request, ^1in 3') time.sleep(1) self.console.say('^1 2') time.sleep(1) self.console.say('^1 1') time.sleep(1) self.console.write('fast_restart') return True def cmd_mode(self, data, client, cmd=None): if not data: client.message('^7Available variables: ^1comp_public^7, ^1comp_public_hc^7, ^1custom_public^7, ^1strat^7, ^1match^7, ^1knockout^7, ^11v1^7, ^12v2^7, ^1lan^7, ^1pb^7, ^1knife^7, ^1hc^7, ^1mr^2X') return False else: self.console.write('promod_mode %s' % data) self.console.say('^2Promod Mode set to ^1 %s^2, in ^1 5' % data) time.sleep(1) self.console.say('^1 4') time.sleep(1) self.console.say('^1 3') time.sleep(1) self.console.say('^1 2') time.sleep(1) self.console.say('^1 1') time.sleep(1) self.console.write('map_restart') return True return True def cmd_assaultlimit(self, data, client, cmd=None): self.console.write('class_assault_limit %s' % data) self.console.say('^1Assault ^2class limit set to ^1%s per team' % data) return True def cmd_demolitionslimit(self, data, client, cmd=None): self.console.write('class_demolitions_limit %s' % data) self.console.say('^1Demolitions ^2class limit set to ^1%s per team' % data) return True def cmd_sniperlimit(self, data, client, cmd=None): self.console.write('class_sniper_limit %s' % data) self.console.say('^1Sniper ^2class limit set to ^1%s per team' % data) return True def cmd_specopslimit(self, data, client, cmd=None): self.console.write('class_specops_limit %s' % data) self.console.say('^1Specops ^2class limit set to ^1%s per team' % data) return True def cmd_assaultdrop(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('class_assault_allowdrop 1') self.console.say('^2Assault class ^1will ^2now drop their weapons on death') return True if input[0] == '0' : self.console.write('class_assault_allowdrop 0') self.console.say('^2Assault class now ^1will not ^2drop their weapons on death') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_demolitionsdrop(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('class_demolitions_allowdrop 1') self.console.say('^2Demolitions class ^1will ^2now drop their weapons on death') return True if input[0] == '0' : self.console.write('class_demolitions_allowdrop 0') self.console.say('^2Demolitions class now ^1will not ^2drop their weapons on death') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_sniperdrop(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('class_sniper_allowdrop 1') self.console.say('^2Sniper class ^1will ^2now drop their weapons on death') return True if input[0] == '0' : self.console.write('class_sniper_allowdrop 0') self.console.say('^2Sniper class now ^1will not ^2drop their weapons on death') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_specopsdrop(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('class_specops_allowdrop 1') self.console.say('^2Specops class ^1will ^2now drop their weapons on death') return True if input[0] == '0' : self.console.write('class_specops_allowdrop 0') self.console.say('^2Specops class now ^1will not ^2drop their weapons on death') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_readyup(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('promod_allow_readyup 1') self.console.say('^2There will now ^1be ^2Ready-up time') return True if input[0] == '0' : self.console.write('promod_allow_readyup 0') self.console.say('^2Now ^1there will not be ^2Ready-up time') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_strattime(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('promod_allow_strattime 1') self.console.say('^2There will now ^1be ^2strat time') return True if input[0] == '0' : self.console.write('promod_allow_strattime 0') self.console.say('^2Now ^1there will not be ^2strat time') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_timeout(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('promod_allow_timeout 1') self.console.say('^2There will now ^1be ^2timeout time') return True if input[0] == '0' : self.console.write('promod_allow_timeout 0') self.console.say('^2Now ^1there will not be ^2timeout time') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_wbhitmarker(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('promod_allow_wbhitmarker 1') self.console.say('^2Wall-bangs ^1will now show ^2hitmarkers') return True if input[0] == '0' : self.console.write('promod_allow_wbhitmarker 0') self.console.say('^2Now wall-bangs ^1will not show ^2hitmakers') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_winningkc(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('promod_allow_winningkc 1') self.console.say('^2Game-winning killcam will now ^1be ^2shown') return True if input[0] == '0' : self.console.write('promod_allow_winningkc 0') self.console.say('^2Now game-winning killcam ^1will not ^2be shown') return True client.message('^7Invalid data, type 1=on or 0=off') return True def cmd_yposition(self, data, client, cmd=None): self.console.write('promod_killed_yposition %s' % data) self.console.say('^2yposition set to ^1%s' % data) return True def cmd_killedtime(self, data, client, cmd=None): self.console.write('promod_killed_time %s' % data) self.console.say('^2Killed time set to ^1%s' % data) return True def cmd_kniferound(self, data, client, cmd=None): if not data: client.message('^7Missing data, type 0=off or 1=on after the command') return False else: input = data.split(' ',1) if input[0] == '1' : self.console.write('promod_allow_kniferound 1') self.console.say('^2There ^1will ^2now be knife round') return True if input[0] == '0' : self.console.write('promod_allow_kniferound 0') self.console.say('^2Now there ^1will not ^2be knife round') return True client.message('^7Invalid data, type 1=on or 0=off') return TrueNow save this code as "plugin_promodadmin.xml", on b3 "extplugins\conf\" folder: (edit the permission levels for each commands as you need it)
Preety simple.
If anything is not working properly, please report.