Skip to content

How to get grenade throw position? #246

Answered by saul
tugamars asked this question in Questions
Discussion options

You must be logged in to vote

Try some code like this:

demoFile.entities.on("create", e => {
  if (!("DT_BaseCSGrenadeProjectile" in e.entity.props)) return;

  const projectileEntity = (e.entity as unknown) as BaseEntity<
    CBaseCSGrenadeProjectile
  >;
  const thrower = projectileEntity.owner as Player;

  console.log(
    "%s threw %s at:",
    thrower ? thrower.name : "(someone)",
    projectileEntity.modelName,
    projectileEntity.position
  );
});

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by saul
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #94 on February 28, 2021 14:00.