set_color error

Please post any questions about developing your plugin here. Please use the search function before posting!
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

set_color error

Postby Tuck » Tue May 06, 2014 4:34 pm

Exception

Code: Select all

[SP]  Caught an Exception:
Traceback (most recent call last):
  File '../addons/source-python/packages/source-python/events/listener.py', line 84, in fire_game_event
    callback(game_event)
  File '../addons/source-python/plugins/tuck/tuck.py', line 40, in player_spawn
    player.set_color((255, 0, 0, 255))
  File '../addons/source-python/packages/source-python/entities/entity.py', line 314, in set_color
    self.rendermode = self.rendermode | 1
  File '../addons/source-python/packages/source-python/entities/entity.py', line 237, in __setattr__
    self.datamaps[attr]._set_value(value)
  File '../addons/source-python/packages/source-python/entities/datamaps.py', line 365, in _set_value
    getattr(self.current_pointer, self.set_attr)(value, self.offset)

Boost.Python.ArgumentError: Python argument types in
    Pointer.set_char(Pointer, int, int)
did not match C++ signature:
    set_char(CPointer {lvalue}, char, int offset=0)


Code:
- I've tried with and without alpha same thing.

Syntax: Select all

from events import Event

from players.helpers import index_from_userid
from players.entity import PlayerEntity

@Event
def player_spawn(GameEvent):
userid = GameEvent.get_int('userid')
index = index_from_userid(userid)
player = PlayerEntity(index)
if not player.isdead and player.name == 'Tuck':
player.set_color((255, 0, 0))
-Tuck
User avatar
devilsnake88
Junior Member
Posts: 7
Joined: Mon Feb 18, 2013 4:03 pm
Contact:

Postby devilsnake88 » Tue May 06, 2014 6:06 pm

Hi,
Look at the end of this script:
http://www.sourcepython.com/showthread.php?105-Spawnprotection&highlight=spawn

Didn't test but you can try.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue May 06, 2014 6:11 pm

The code in that thread is really old, so none of it will work. We will look into that issue, though, the BaseEntity class is going to get another major overhaul here very soon, so we would be wasting time trying to figure this out until then. Note that "usage" of the BaseEntity/PlayerEntity class will not be changing, just how it works internally will.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 35 guests