Lua API
  • 🔎Overview
  • Introduction
    • 🚀Creating scripts
      • 🧠First Steps
      • 🖥️Adding UI
      • 📚Creating Libraries
  • API
    • 🌐Global Functions
    • ⚙️Instances
      • 🔢Math
      • ☎️Events
        • event_t
      • 🎮Game
        • global_vars_t
        • cengine_client
          • cnet_chan
        • ccsgo_input
        • cinput_system
        • cgame_ui_funcs
        • ccvar
          • convar
      • 🕹️Mods
        • events_t
      • ✏️Draw
        • ⚙️Types
          • ⚙️rect
          • ⚙️vec2
          • ⚙️color
          • ⚙️accessor
        • 🖥️Adapter
        • ✏️Layer
          • outline_mode
          • rounding
          • glow_parts
          • text_params
            • text_alignment
          • shadow_dir
          • command
            • render_mode
        • 🖼️Managed
          • 🖼️texture
            • svg_texture
            • animated_texture
          • 🖼️shader
          • ™️font_base
            • font
            • font_gdi
            • glyph_t
            • font_flags
      • 🙋Entities
        • entity_list_t
          • entity_entry_t
        • base_entity
          • schema_accessor_t
          • cs2_weapon_base_gun
          • cs2_player_pawn
          • cs2_player_controller
          • cs2_weapon_base
          • cs2_grenade_projectile
        • ccsweapon_base_vdata
          • cfiring_mode
        • chandle
        • csweapon_mode
        • csweapon_type
        • weapon_id
        • csweapon_category
        • observer_mode_t
      • 🖥️Gui
        • ⚙️Types
          • ⚙️bits
          • ⚙️control_id
        • context
          • user_t
        • context_input
          • mouse_button
        • notification_system
          • notification
        • control
          • control_type
          • value_param
          • checkbox
          • slider
          • label
          • selectable
          • button
          • color_picker
          • spacer
          • text_input
          • combo_box
          • image
        • container
          • control_container
            • layout
            • group
      • ⚙️Utils
    • ⚙️Types
      • ⚙️ptr
      • ⚙️ref_holder_t
      • ⚙️vector
      • ⚙️vector4d
      • 🎮veccolor
      • 🎮color
      • 🎮cview_setup
      • 🎮cuser_cmd
      • 🎮game_event_t
    • 🟰Enums
      • 🟰client_frame_stage
      • 🟰input_bit_mask
Powered by GitBook

© 2025 - FATALITY

On this page
  • get_abs_origin
  • get_max_speed
  • get_inaccuracy
  • get_spread
  • get_id
  • get_type
  • get_data
  • is_gun
  • is_attackable
  • has_secondary_attack
  • has_spread
Export as PDF
  1. API
  2. Instances
  3. Entities
  4. base_entity

cs2_weapon_base_gun

Previousschema_accessor_tNextcs2_player_pawn

Last updated 3 months ago

This type represents a CCSWeaponBaseGun class.

This type inherits type. All of its base methods and fields are also available in this type.

get_abs_origin

Returns the absolute origin (the one that is used for rendering).

Arguments

None.

Returns

Type

Description

Origin.

Example

local org = wep:get_abs_origin();

get_max_speed

Returns the maximal player speed when holding this weapon.

Arguments

None.

Returns

Type

Description

float

Max speed, in UPS.

Example

local spd = wep:get_max_speed();

get_inaccuracy

Returns the current inaccuracy value.

Arguments

Name

Type

Description

mode

Weapon mode.

Returns

Type

Description

float

Inaccuracy value.

Example

local inacc = wep:get_inaccuracy(csweapon_mode.primary_mode);

get_spread

Returns the current spread value.

Arguments

Name

Type

Description

mode

Weapon mode.

Returns

Type

Description

float

Inaccuracy value.

Example

local spread = wep:get_spread(csweapon_mode.primary_mode);

get_id

Returns the weapon ID.

Arguments

None.

Returns

Type

Description

Weapon ID.

Example

local wep_id = wep:get_id();

get_type

Returns the weapon type.

Arguments

None.

Returns

Type

Description

Weapon type.

Example

local type = wep:get_type();

get_data

Returns the weapon static data.

Arguments

None.

Returns

Type

Description

Weapon data.

Example

local data = wep:get_data();

is_gun

Returns true if this weapon is a firearm.

Arguments

None.

Returns

Type

Description

bool

true if a firearm.

Example

if wep:is_gun() then
    -- ...
end

is_attackable

Returns true if you can attack with this weapon.

Arguments

None.

Returns

Type

Description

bool

true if can attack.

Example

if wep:is_attackable() then
    -- ...
end

has_secondary_attack

Returns true if this weapon has a secondary attack mode.

Arguments

None.

Returns

Type

Description

bool

true if has the secondary attack mode.

Example

if wep:has_secondary_attack() then
    -- ...
end

has_spread

Returns true if this weapon has spread (e.g. knives do not have any spread).

Arguments

None.

Returns

Type

Description

bool

true if has spread.

Example

if wep:has_spread() then
    -- ...
end

⚙️
🙋
base_entity
vector
csweapon_mode
csweapon_mode
weapon_id
csweapon_type
ccsweapon_base_vdata