Syntax: Select all
from players.entity import PlayerEntity
from players.helpers import index_from_userid
from events import Event
@Event
def player_spawn(game_event):
entity = PlayerEntity(index_from_userid(game_event.get_int('userid')))
entity.health += 50
But today when I tried, I get the following error:
[SP] Caught an Exception:
Traceback (most recent call last):
File '..\addons\source-python\packages\source-python\events\listener.py', line
90, in fire_game_event
callback(game_event)
File '..\addons\source-python\plugins\test\test.py', line 8, in player_spawn
entity.health += 50
File '..\addons\source-python\packages\source-python\entities\entity.py', line
83, in __getattr__
raise AttributeError('Attribute '{0}' not found'.format(attr))
AttributeError: Attribute 'health' not found
Same happens for 'speed', didn't try others but I guess there are others too.
Is it mine or Source.Python's fault? Any fixes?