- ServerCommandRegistry:
- register_command:
- <names>
- <callback>
- [description]
- [flags]
- unregister_command:
- <names>
- <callback>
- Use:
Syntax: Select all
from commands.server import ServerCommandRegistry
def server_command_callback(CCommand):
print('Test command just called')
ServerCommandRegistry.register_command('test_command', server_command_callback, 'Test command')
def unload():
ServerCommandRegistry.unregister_command('test_command', server_command)
- register_command:
- ClientCommandRegistry:
- register_command:
- <names>
- <callback>
- [level]
- [permission]
- [flag]
- [fail_callback]
- unregister_command:
- <names>
- <callback>
- Use:
Syntax: Select all
from commands.client import ClientCommandRegistry
def client_command_callback(edict, CCommand):
print('Test client command just called')
ClientCommandRegistry.register_command('client_test', client_command_callback)
def unload():
ClientCommandRegistry.unregister_command('client_test', client_command_callback)
- register_command:
- SayCommandRegistry:
- register_command:
- <names>
- <callback>
- [level]
- [permission]
- [flag]
- [fail_callback]
- unregister_command:
- <names>
- <callback>
- Use:
Syntax: Select all
from commands.client import SayCommandRegistry
def say_command_callback(index, teamonly, CCommand):
print('Test say command just called')
SayCommandRegistry.register_command('say_test', say_command_callback)
def unload():
SayCommandRegistry.unregister_command('say_test', say_command_callback)
- register_command:
With ClientCommandRegistry and SayCommandRegistry, you can also register filters (though client command filters has not been added, as of yet):
Syntax: Select all
from commands.client import ClientCommandRegistry
from commands.say import SayCommandRegistry
def load():
ClientCommandRegistry.register_filter(client_command_filter)
SayCommandRegistry.register_filter(say_filter)
def client_command_filter(edict, CCommand):
print('Client Command Filter')
def say_filter(index, teamonly, CCommand):
print('Say Filter')
def unload():
ClientCommandRegistry.unregister_filter(client_command_filter)
SayCommandRegistry.unregister_filter(say_filter)
You can also, of course, use the decorators to register your commands/filters, and they will automatically be unregistered when you unload your script:
Syntax: Select all
from commands.client import ClientCommand
from commands.client import ClientCommandFilter
from commands.say import SayCommand
from commands.say import SayFilter
from commands.server import ServerCommand
@ClientCommand('client_test')
def client_command_test(edict, CCommand):
print('Client Command Test')
@ClientCommandFilter
def client_command_filter_test(edict, CCommand):
print('Client Command Filter Test')
@SayCommand('say_test')
def say_command_test(index, teamonly, CCommand):
print('Say Command Test')
@SayFilter
def say_filter_test(index, teamonly, CCommand):
print('Say Filter Test')
@ServerCommand('server_test')
def server_command_test(CCommand):
print('Server Command Test')
If you notice any bugs, have any questions/comments, please feel free to post them.
Satoon