if been reworking a restriction system I made and I used this hook to determine which weapon was bought:
Syntax: Select all
@EntityPreHook(EntityCondition.is_player, 'buy_internal')
def pre_buy(args):
"""Called when a player is about to buy something."""
# Get a PlayerEntity object from the pointer passed
player = Player(index_from_pointer(args[0]))
userid = player.userid
# Get the weapon name the player is about to buy
weapon = 'weapon_'+args[1]
The problem is that args[1] does no longer return a weapons name but rather a number. I looked for the WeaponID constants and when I printed args[1] I found that the numbers did not match. AK47 for example is defined as 27 in the constants but when I buy it it prints 15. AWP is defined as 17 but prints 18 for me.
The question is if the data is outdated or if I'm doing something wrong.
Thank you :)