def on_example_number(self, command, params, silent, **kwargs): extra = kwargs.get('extra', {}) uniqueid = extra.get('uniqueid', '') # We don't have access. Return. if not has_access(uniqueid, 'admin'): # Keep processing other plugins. return True rcon_client.say('on_example_number was called: %s' % command) # Keep processing other plugins. return True
def remaining_commands(self, command, params, silent, **kwargs): """This function will be called when any command except example1 and example2 is executed. It would be a really good idea to check whether you want to handle this command and return immediately if you don't.""" extra = kwargs.get('extra', {}) uniqueid = extra.get('uniqueid', '') # We don't have access. Return. if not has_access(uniqueid, 'admin'): # Keep processing other plugins. return True rcon_client.say('remaining_commands was called: %s' % command) # Keep processing other plugins. return True
def on_command(self, command, params, silent, **kwargs): extra = kwargs.get('extra', {}) uniqueid = extra.get('uniqueid', '') # We don't have access. Return. if not has_access(uniqueid, 'admin'): # Keep processing other plugins. return True # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Restart round if command == 'r' or command == 'rr': wait = params if params else '1' rcon_client.cvar('sv_restart', wait) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Map elif command == 'map' or command == 'changelevel': rcon_client.changelevel(params) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Say elif command == 'say': rcon_client.say(params) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Hostname say elif command == 'hsay': p = params.split(' ', 1) if len(p) > 1: rcon_client.hsay(p[0], ' '.join(p[1:])) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Password elif command == 'pass' or command == 'password': if params: rcon_client.cvar('sv_password', params) if not silent: rcon_client.hsay('', 'Set password to: %s' % params) else: #============================== def got_password(value): rcon_client.hsay('', 'Password is set to: %s' % value) rcon_client.cvar('sv_password').addCallback(got_password) # Keep processing other plugins. return True