Code: Select all
Traceback (most recent call last):
File '../addons/source-python/packages/source-python/entities/hooks.py', line 184, in on_entity_created
_waiting_entity_hooks.initialize(index)
File '../addons/source-python/packages/source-python/entities/hooks.py', line 170, in initialize
if hook.initialize(entity):
File '../addons/source-python/packages/source-python/entities/hooks.py', line 131, in initialize
self.hooked_function = getattr(entity, self.function)
File '../addons/source-python/packages/source-python/entities/entity.py', line 102, in __getattr__
raise AttributeError('Attribute '{0}' not found'.format(attr))
AttributeError: Attribute 'run_command' not found
Here's the really minimal code I was testing with:
Syntax: Select all
from entities.hooks import EntityCondition, EntityPreHook
from players import UserCmd
from memory import make_object
@EntityPreHook(EntityCondition.is_player, "run_command")
def classmenu(stack):
print(make_object(UserCmd, stack[1]).buttons)
What's going wrong here?
(I'm using the latest version of SourcePython)