-
Hello! From what I can see there isn't an "easy" way of getting player buy events is this correct? I'm kind of assuming I'll have to do something weird like watch for differences in player Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
saul
Feb 27, 2022
Replies: 1 comment 1 reply
-
Take a look at the purchases example. Specifically the bit you need is: demoFile.entities.on("create", e => {
const weapon = e.entity;
if (!(weapon instanceof Weapon)) return;
const owner = weapon.owner;
if (!owner) return;
// Skip over weapons that are given and not bought
if (
weapon.serverClass.name === "CKnife" ||
weapon.serverClass.name === "CC4" ||
(owner.teamNumber === 2 && weapon.serverClass.name === "CWeaponGlock") ||
(owner.teamNumber === 3 && weapon.serverClass.name === "CWeaponHKP2000")
)
return;
console.log(
`'${owner.name}' just bought a '${weapon.itemName}' (${weapon.quality})`
);
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
saul
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take a look at the purchases example. Specifically the bit you need is: