why won't this work?
Syntax: Select all
from events import Event
from players.entities import Player
from players.helpers import index_from_userid
class Player(PlayerEntity):
def __init__(self, index):
super(Player, self).__init__()
def equip(self, item):
"""
Equips the player with an item
"""
# create a new item entity
entity = BaseEntity(create_entity(item))
# set its origin to the player's
entity.origin = self.origin
# spawn it there
spawn_entity(entity.index)
# if it was a weapon, set it as the active weapon
if item.startswith("weapon_"):
tick_delays.delay(0.2, self.set_property_int, "m_hActiveWeapon", entity.inthandle)
@Event
def player_say(game_event):
player = Player(index_from_userid(game_event.get_int("userid")))
player.equip("weapon_ak47") # -- works
player.equip("item_assaultsuit") # -- doesn't work, but
player.give_named_item("item_assaultsuit", 0) # works for CS:S