-
I don't know if this is an issue on demofile's side or not, but it looks some weapons aren't reported correctly on the PlayerHurt The 4 examples I have are:
The PlayerDeath event though does have the right weapon. I was really just wondering if anyone else noticed this for the PlayerHurt event |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This is simply how the weapons are reported in the demoFile.gameEvents.on("player_hurt", e => {
const victim = demoFile.entities.getByUserId(e.userid);
const attacker = demoFile.entities.getByUserId(e.attacker);
console.log(
`${attacker?.name} hit ${victim?.name} [${attacker?.weapon?.itemName}] for ${e.dmg_health} HP`
);
}); The game does this transformation for you already on |
Beta Was this translation helpful? Give feedback.
This is simply how the weapons are reported in the
player_hurt
event. If you want to get the actual weapon name, you need to get the attacking player entity, get their active weapon, then get the item name. Something like:The game does this transformation for you already on
player_death
, but for some reason they didn't do it forplayer_hurt
.