Page 1 of 1

PlayerEntity's properties broken?

Posted: Mon Feb 02, 2015 1:00 pm
by Mahi
This used to work a week or two ago:

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?

Posted: Mon Feb 02, 2015 5:22 pm
by satoon101
I am assuming this is for CS:GO, correct? We are working on adding more to the entities data for that game to catch it back up to where it was.
http://forums.sourcepython.com/showthread.php?737

Posted: Tue Feb 03, 2015 4:02 pm
by Mahi
Ah yes, it's for CS:GO. Okay thanks, good to know :)