as a real player, I get a flashbang perfectly fine when using this code:
Syntax: Select all
class Player(PlayerEntity):
def __init__(self, index):
super(Player, self).__init__()
def equip(self):
"""
Equips the player with a flashbang
"""
# remove any existing flashbangs from the player
if self.get_property_int("localdata.m_iAmmo.012"):
self.strip()
self.set_property_int("localdata.m_iAmmo.012", 0)
# create a new flashbang entity
flashbang = BaseEntity(create_entity("weapon_flashbang"))
# set its origin to the player's
flashbang.origin = self.origin
# spawn it there
spawn_entity(flashbang.index)
Syntax: Select all
from events import Event
from flashfunsp.players import Player
@Event
def flashbang_detonate(game_event):
"""
Gets called whenever a flashbang grenade detonates.
"""
# re-equip the player with a flashbang after a second
tick_delays.delay(1, Player(index_from_userid(game_event.get_int("userid"))).equip)
But Bots don't :(
Tho, they seem to get the flashbang entity as they drop it after I killed them and I can actually pick it up. Why is that? Did I forget something? :)
within equip(), self.give_named_item() works fine for bots and real players, but only for CS:S because it's commented out in csgo/CBasePlayer.ini..