It appears you have not registered with our community. To register please click here ...
#Set the command level on line 21. Should be fairly obvious.__version__ = 'infinity.0'__author__ = 'Megak'import b3import b3.events# Import the necessary libaries you need here, for example, I need random for the randomization of answers part of it.#--------------------------------------------------------------------------------------------------#This lot doesn't need to be changed for simple commands, it gets the admin plugin and registers commands.class MegakPlugin(b3.plugin.Plugin): _adminPlugin = None requiresConfigFile = False def onStartup(self): self._adminPlugin = self.console.getPlugin('admin') if not self._adminPlugin: return False #SET COMMAND LEVEL HERE self._adminPlugin.registerCommand(self, 'getip', 90, self.cmd_getip) self._adminPlugin.registerCommand(self, 'banip', 90, self.cmd_ipban) self.registerEvent(b3.events.EVT_CLIENT_SAY) self.registerEvent(b3.events.EVT_CLIENT_TEAM_SAY) self.registerEvent(b3.events.EVT_CLIENT_AUTH) self.registerEvent(b3.events.EVT_CLIENT_CONNECT) def onEvent(self, event): """\ Handle intercepted events """ if event.type == b3.events.EVT_CLIENT_CONNECT: cursor = self.console.storage.query( "SELECT * FROM ippens WHERE ip= %s" % event.client.ip) if cursor.rowcount >=1: self.console.kick(event.client.cid, "Banned IP", None, True) cursor.close() def cmd_getip(self, data, client=None, cmd=None): input = self._adminPlugin.parseUserCmd(data) cursor = self.console.storage.query( "SELECT ip, name FROM clients WHERE id= %s" % input[0]) r = cursor.getRow() client.message('%s IP: %s' % (r['name'], r['ip'])) cursor.close() def cmd_ipban(self, data, client=None, cmd=None): input = self._adminPlugin.parseUserCmd(data) cursor = self.console.storage.query( "INSERT INTO ippens VALUES (0,%s)" % input[0]) cursor.close()
"SELECT * FROM ippens WHERE ip= '%s'" % event.client.ip