Class Weapon

Represents an in-game weapon (guns, grenades, knifes).

Hierarchy

Constructors

Properties

_demo: DemoFile
classId: number

Server class ID.

deleting: boolean = false

Entity is scheduled for removal this tick.

index: number

Entity index.

serialNum: number

Serial number.

Accessors

  • get className(): null | string
  • Returns

    Entity class name of the weapon (e.g. "weapon_ak47")

    Returns null | string

  • get handle(): number
  • Returns

    Number uniquely identifying this entity. Should be unique throughout the entire demo.

    Returns number

  • get isDormant(): boolean
  • True if this entity is out of the PVS. Always false on GOTV demos as all entities are always in the PVS.

    Returns boolean

  • get itemName(): null | string
  • Returns

    Name of the weapon (e.g. "Five-SeveN")

    Returns null | string

  • get modelName(): null | string
  • Returns

    Name of the model that should be rendered for this entity. (e.g. 'models/Weapons/w_eq_smokegrenade_thrown.mdl')

    Returns null | string

  • get ownerAmmo(): null | number
  • Returns

    The amount of ammo the owner holds for this weapon. Null if no owner.

    Returns null | number

  • get quality(): "normal" | "genuine" | "vintage" | "unusual" | "unique" | "community" | "developer" | "selfmade" | "customized" | "strange" | "completed" | "haunted" | "tournament" | "favored"
  • Returns

    Quality of the item.

    Returns "normal" | "genuine" | "vintage" | "unusual" | "unique" | "community" | "developer" | "selfmade" | "customized" | "strange" | "completed" | "haunted" | "tournament" | "favored"

  • get reserveAmmo(): number
  • Returns

    The amount ammo this weapon has in reserve

    Returns number

  • get teamNumber(): number
  • Returns

    Team number (0: Unassigned, 1: Spectator, 2: Terrorist, 3: Counter-Terrorist)

    Returns number

Methods

  • Interpret an array-like data table (e.g., m_iAmmo) as an array

    Type Parameters

    • TableName extends keyof CWeaponCSBase

    • TableKeys extends string | number | symbol

    • ArrayType extends undefined | readonly CWeaponCSBase[TableName][TableKeys][]

    Parameters

    • tableName: TableName

      Name of the data table

    Returns ArrayType

  • Retrieves the value of a networked property

    Returns

    Property value, undefined if non-existent

    Type Parameters

    • Table extends keyof CWeaponCSBase

    • VarName extends string | number | symbol

    Parameters

    • tableName: Table

      Table name (e.g., DT_BaseEntity)

    • varName: VarName

      Network variable name (e.g., m_vecOrigin)

    Returns CWeaponCSBase[Table][VarName]

  • Update the value of a prop

    Type Parameters

    • Table extends keyof CWeaponCSBase

    • VarName extends string | number | symbol

    • PropType

    Parameters

    • tableName: Table

      Name of the data table

    • varName: VarName

      Name of the prop to update

    • newValue: PropType

      New prop value

    Returns void

Generated using TypeDoc