Admin Commands

Release your plugins here!
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Admin Commands

Postby necavi » Mon Apr 20, 2015 12:10 am

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
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Wed May 20, 2015 2:30 am

Updated to use sp_utils for colourization and changed sp_slay to use FakeClientCommands rather than take_damage
nergal
Member
Posts: 57
Joined: Sun Mar 15, 2015 2:58 pm

Postby nergal » Fri Jun 05, 2015 1:59 am

tried to load it but got an error.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Fri Jun 05, 2015 4:29 am

Could you please post the error?
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Fri Jun 05, 2015 4:50 am

Probably an interface change from the newer version of SP? I'll take a look at it shortly.
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Fri Jun 05, 2015 5:27 am

Ah, something went a little screwy at some point. Loads fine with the newest version.
Tank Missile
Junior Member
Posts: 4
Joined: Wed Jun 03, 2015 4:16 am

Postby Tank Missile » Sun Jul 26, 2015 1:06 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.
tnarocks
Member
Posts: 56
Joined: Fri Aug 03, 2012 1:35 am

Postby tnarocks » Sun Feb 14, 2016 1:10 am

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: :p ython::api: :o 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.
necavi
Developer
Posts: 129
Joined: Wed Jan 30, 2013 9:51 pm

Postby necavi » Sat Mar 26, 2016 9:11 pm

Quite late but I've updated this plugin for the new SourcePython versions, thus fixing that particular bug.
Tank Missile
Junior Member
Posts: 4
Joined: Wed Jun 03, 2015 4:16 am

Re: Admin Commands

Postby Tank Missile » Wed Apr 12, 2017 6:43 am

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.

Return to “Plugin Releases”

Who is online

Users browsing this forum: Google [Bot] and 18 guests