This is the beginnings of a comprehensive admin command system for Source Python.
Currently it only has a few features, but I'm happy to add any that the community requests.
Filter types:
- All filters listed here: http://wiki.sourcepython.com/pages/filt ... PlayerIter
- me - Target yourself
- ! filters - All filters support ! as well. Example: @!me targets all players EXCEPT yourself, @!bots targets all humans, etc
Commands (each can be used on the server/client console as well as in chat with !<command> and /<command>):
- sp_kick <name|#userid|@filter> [reason: ""] (Permission: sp.punishment.kick) - Kicks the client(s) from the server, optionally with the reason specified
- sp_ban <name|#userid|@filter> [minutes: 0] [reason: ""] (Permission: sp.punishment.ban - Kicks and bans the client(s) from the server, for the duration specified by minutes and a kickreason specified by reason
- sp_unban <steamid> (Permission: sp.punishment.unban) - Unbans a steamID
- sp_slay <name|#userid|@filter> (Permission: sp.punishment.slay) - Slays the target client(s).
- sp_ignite <name|#userid|@filter> [time: 0] (Permission: sp.fun.ignite) - Sets the target client(s) on fire for the duration specified by minutes
- sp_freeze <name|#userid|@filter> [time: 0] (Permission: sp.fun.freeze) - Freezes the target client(s) in place for the duration specified by minutes
- sp_unfreeze <name|#userid|@filter> (Permission: sp.fun.unfreeze) - Unfreezes the target client(s)
- sp_map <map> (Permission: sp.map.map) - Change the map to the specified map (if it exists)
Note: The permission nodes and names listed here are subject to change in the future
Upcoming features:
- Menus
- sp_rename
- mute/gag/silence
Feel free to suggest anything, I'm happy to add it, if it is currently possible
Download here
Admin Commands
-
- Junior Member
- Posts: 4
- Joined: Wed Jun 03, 2015 4:16 am
[SP] Caught an Exception:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\messages\base.py', line 340, in __getattr__
return super(BaseMessage, self).__getattr__(attribute)
AttributeError: 'super' object has no attribute '__getattr__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\messages\base.py', line 521, in _send_message
parameter_name, kwargs[parameter_name])
File '..\addons\source-python\packages\source-python\messages\types\saytext.py', line 36, in _prepare_parameter
self._message_prefix)[0] + return_value
File '..\addons\source-python\packages\source-python\messages\base.py', line 346, in __getattr__
return self[attribute]
File '..\addons\source-python\packages\source-python\messages\base.py', line 379, in __getitem__
item, self._message_name))
KeyError: ''_message_prefix' is not a valid 'SayText2' parameter.'
'You have been frozen.' is not a valid value for 'SayText2.message'
[SP] Caught an Exception:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\messages\base.py', line 340, in __getattr__
return super(BaseMessage, self).__getattr__(attribute)
AttributeError: 'super' object has no attribute '__getattr__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\messages\base.py', line 521, in _send_message
parameter_name, kwargs[parameter_name])
File '..\addons\source-python\packages\source-python\messages\types\saytext.py', line 36, in _prepare_parameter
self._message_prefix)[0] + return_value
File '..\addons\source-python\packages\source-python\messages\base.py', line 346, in __getattr__
return self[attribute]
File '..\addons\source-python\packages\source-python\messages\base.py', line 379, in __getitem__
item, self._message_name))
KeyError: ''_message_prefix' is not a valid 'SayText2' parameter.'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\messages\base.py', line 340, in __getattr__
return super(BaseMessage, self).__getattr__(attribute)
AttributeError: 'super' object has no attribute '__getattr__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\commands\manager.py', line 151, in __call__
return_value = callback(*args)
File '..\addons\source-python\plugins\admin_commands\utils\utils.py', line 146, in server_command_callback
return self.callback(CommandSourceProxy('server'), command)
File 'commands\fun.py', line 47, in sp_ignite
File '..\addons\source-python\plugins\admin_commands\utils\utils.py', line 72, in message_client
SayText2(message=colourize(message)).send(index)
File '..\addons\source-python\packages\source-python\messages\base.py', line 600, in send
recipient, **ChainMap(translated_parameters, self))
File '..\addons\source-python\packages\source-python\messages\base.py', line 539, in _send_message
parameter_name, parameter_data['default_value'])
File '..\addons\source-python\packages\source-python\messages\types\saytext.py', line 36, in _prepare_parameter
self._message_prefix)[0] + return_value
File '..\addons\source-python\packages\source-python\messages\base.py', line 346, in __getattr__
return self[attribute]
File '..\addons\source-python\packages\source-python\messages\base.py', line 379, in __getitem__
item, self._message_name))
KeyError: ''_message_prefix' is not a valid 'SayText2' parameter.'
I'm getting this error when I try to use any of the commands. The commands also fail to work when I enter them in chat, and I get no "usage" response from them.
When i try to load this plugin i get a error. and this is the error
21:06:51 sp load admin_commands
21:06:51 [SP] Loading plugin 'admin_commands'...
[SP] Caught an Exception:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\plugins\manager.py', line 71, in __missing__
instance = self.instance(plugin_name, self.base_import)
File '..\addons\source-python\packages\source-python\plugins\instance.py', line 82, in __init__
self._plugin = import_module(import_name)
File '..\addons\source-python\plugins\admin_commands\admin_commands.py', line 16, in <module>
info.convar = PublicConVar(info.variable, info.version, 0, info.name + ' Version')
File '..\addons\source-python\packages\source-python\cvars\public.py', line 33, in __init__
name, value, description, flags, min_value, max_value)
File '..\addons\source-python\packages\source-python\cvars\__init__.py', line 56, in __init__
max_value is not None, max_value or 0.0)
Boost.Python.ArgumentError: Python argument types in
_ConVar.__init__(PublicConVar, str, str, int, str, bool, float, bool, float)
did not match C++ signature:
__init__(class boost:
ython::api:
bject, char const *, char const * szDefaultValue='', char const * szHelpString='', int flags=0, bool bMin=False, float fMin=0.0, bool bMax=False, float fMax=0.0)
[SP] Plugin 'admin_commands' was unable to be loaded.
21:06:51 sp load admin_commands
21:06:51 [SP] Loading plugin 'admin_commands'...
[SP] Caught an Exception:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\plugins\manager.py', line 71, in __missing__
instance = self.instance(plugin_name, self.base_import)
File '..\addons\source-python\packages\source-python\plugins\instance.py', line 82, in __init__
self._plugin = import_module(import_name)
File '..\addons\source-python\plugins\admin_commands\admin_commands.py', line 16, in <module>
info.convar = PublicConVar(info.variable, info.version, 0, info.name + ' Version')
File '..\addons\source-python\packages\source-python\cvars\public.py', line 33, in __init__
name, value, description, flags, min_value, max_value)
File '..\addons\source-python\packages\source-python\cvars\__init__.py', line 56, in __init__
max_value is not None, max_value or 0.0)
Boost.Python.ArgumentError: Python argument types in
_ConVar.__init__(PublicConVar, str, str, int, str, bool, float, bool, float)
did not match C++ signature:
__init__(class boost:


[SP] Plugin 'admin_commands' was unable to be loaded.
-
- Junior Member
- Posts: 4
- Joined: Wed Jun 03, 2015 4:16 am
Re: Admin Commands
Getting this error when attempting to load the plugin.
Code: Select all
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 162, in load_plugin plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 193, in load plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load self.module = import_module(self.import_name)
File "../addons/source-python/plugins/admin_commands/admin_commands.py", line 9, in <module> from . import bans, commands
ImportError: cannot import name 'bans'
Last edited by Ayuto on Wed Apr 12, 2017 7:05 am, edited 1 time in total.
Who is online
Users browsing this forum: No registered users and 128 guests