# Welcome

Welcome to the official Neverlose wiki!

![](/files/ciQiDJejBj8yCl7zoANU)

## About

Neverlose is a unique software providing huge functionality and easy setup, with a fast and friendly support team.

## Getting Started

For information on how to get started with lua scripting, check out the link below.

{% content-ref url="/pages/PKLMRpPzfIQJaidn6e7j" %}
[Quick start](/useful-information/quick-start)
{% endcontent-ref %}

## Current features

| Library                                          | Description                                                                                         |
| ------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| [LuaJIT 2.1.0](https://github.com/LuaJIT/LuaJIT) | LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.                           |
| [FFI](https://luajit.org/ext_ffi.html)           | The FFI library allows calling external C functions and using C data structures from pure Lua code. |
| [BIT](https://bitop.luajit.org/api.html)         | BitOp is a C extension module for Lua which adds bitwise operations on numbers.                     |

## Disclaimer

Arguments in square brackets are optional.

## Documentation errors

This documentation was made by Salvatore and Serene. Please report any errors in the documentation either to us in a private message on the forum or to Serene#1337 on Discord.


# Quick start

Guide to writing lua scripts for Neverlose

## :clipboard: Text editor

The best text editors make it simple and easy to code without formatting issues corrupting it.

<table><thead><tr><th width="150">Text editor</th><th>Link</th></tr></thead><tbody><tr><td><span data-gb-custom-inline data-tag="emoji" data-code="1f947">🥇</span> Visual Studio Code</td><td><a href="https://code.visualstudio.com">code.visualstudio.com</a></td></tr><tr><td><span data-gb-custom-inline data-tag="emoji" data-code="1f948">🥈</span> Sublime Text</td><td><a href="https://www.sublimetext.com">sublimetext.com</a></td></tr><tr><td><span data-gb-custom-inline data-tag="emoji" data-code="1f949">🥉</span> Notepad++</td><td><a href="https://notepad-plus-plus.org">notepad-plus-plus.org</a></td></tr></tbody></table>

## :beginner: Beginner's guide

If you're new to Lua scripting, we'd recommend to take a look at the «[Lua in 5 minutes](https://learnxinyminutes.com/docs/lua/)» guide

## :blue\_book: Learn more

{% content-ref url="/pages/Neumn9dJ9DNgWD7F3mNu" %}
[Common knowledge](/useful-information/common-knowledge)
{% endcontent-ref %}

{% content-ref url="/pages/PIbzOa0ZHFuQquOMnl4P" %}
[Examples](/useful-information/script-examples)
{% endcontent-ref %}


# Common knowledge

### Script location

Neverlose scripts are located in the `Counter-Strike Global Offensive\nl` directory.

{% hint style="info" %}
There's no need to back up your scripts - they are automatically synchronized and stored on the Neverlose servers.
{% endhint %}

### Script environment

Each script runs in it's own separate environment. This means that global variables can not be reused between scripts.


# Examples

Overview of the different script examples available to use


# Materials

```lua
local var_flags = {
    ["DEBUG"] = 0,
    ["NO_DEBUG_OVERRIDE"] = 1,
    ["NO_DRAW"] = 2,
    ["USE_IN_FILLRATE_MODE"] = 3,
    ["VERTEXCOLOR"] = 4,
    ["VERTEXALPHA"] = 5,
    ["SELFILLUM"] = 6,
    ["ADDITIVE"] = 7,
    ["ALPHATEST"] = 8,
    ["MULTIPASS"] = 9,
    ["ZNEARER"] = 10,
    ["MODEL"] = 11,
    ["FLAT"] = 12,
    ["NOCULL"] = 13,
    ["NOFOG"] = 14,
    ["IGNOREZ"] = 15,
    ["DECAL"] = 16,
    ["ENVMAPSPHERE"] = 17,
    ["NOALPHAMOD"] = 18,
    ["ENVMAPCAMERASPACE"] = 19,
    ["BASEALPHAENVMAPMASK"] = 20,
    ["TRANSLUCENT"] = 21,
    ["NORMALMAPALPHAENVMAPMASK"] = 22,
    ["NEEDS_SOFTWARE_SKINNING"] = 23,
    ["OPAQUETEXTURE"] = 24,
    ["ENVMAPMODE"] = 25,
    ["SUPPRESS_DECALS"] = 26,
    ["HALFLAMBERT"] = 27,
    ["WIREFRAME"] = 28,
    ["ALLOWALPHATOCOVERAGE"] = 29,
    ["IGNORE_ALPHA_MODULATION"] = 30,
    ["VERTEXFOG"] = 31
}

local var_flags_names = {}

for var_flag_name in pairs(var_flags) do
	var_flags_names[#var_flags_names + 1] = var_flag_name
end

table.sort(var_flags_names)

local group_ref = ui.find("Visuals", "Players", "Self", "Chams", "Weapon"):create()
local var_flags_ref = group_ref:listable("Var Flags", var_flags_names)

var_flags_ref:set_callback(function(var_flags_ref)
	local selected_var_flags = {}

	for _, selected_index in ipairs(var_flags_ref:get()) do
		local var_flag_name = var_flags_names[selected_index]
		local var_flag = var_flags[var_flag_name]

		selected_var_flags[#selected_var_flags + 1] = var_flag
	end

	for _, mat in ipairs(materials.get_materials("neverlose/self/weapon")) do
		for _, var_flag in pairs(var_flags) do
			mat:var_flag(var_flag, false)
		end

		for _, var_flag in ipairs(selected_var_flags) do
			mat:var_flag(var_flag, true)
		end
	end
end, true)

events.shutdown:set(function()
	for _, mat in ipairs(materials.get_materials("neverlose/self/weapon")) do
		mat:reset()
	end
end)
```


# Color

### Color Pseudocode

```lua
-- Colors have a flexible constructor
local foo = color(255, 0, 0, 255)
local bar = color("#00FF00FF")

-- There are 4 fields you can access: "r", "g", "b", and "a"
print(string.format("r: %d, g: %d, b: %d, a: %d", foo.r, foo.g, foo.b, foo.a))

-- You can also set them by manually indexing them like so
foo.r, foo.g, foo.b, foo.a = 0, 0, 255, 200

-- or by initializing it with several functions that our API has to offer
foo:as_fraction(1, 0, 1, 1)

-- There are a lot of built-in ways to interpret colors
print(bar) --> color(0, 255, 0, 255)
print(foo:to_hex()) --> FF0000FF
print(string.format("r: %d, g: %d, b: %d, a: %d", foo:unpack()))

-- Learn more at Variables -> color
```


# Vector

### Closest Enemy To Crosshair

```lua
-- You can create your own vector objects
-- All vectors are 3D
local vec = vector(1, 2, 3)

-- There are 3 fields you can access: "x", "y", and "z"
print(string.format("x: %.2f, y: %.2f, z: %.2f", vec.x, vec.y, vec.z))

-- You can also set them
vec.x, vec.y, vec.z = 0, 0, 0

events.render:set(function()
	-- All vectors are 3D, even the ones you'd expect to be 2D
	local screen_center = render.screen_size() * 0.5

	local local_player = entity.get_local_player()
	if not local_player or not local_player:is_alive() then
		return
	end

	local camera_position = render.camera_position()

	-- Even angles are 3D vectors
	-- x is pitch, y is yaw, z is roll
	local camera_angles = render.camera_angles()

	-- Let's convert it to a forward vector though
	local direction = vector():angles(camera_angles)

	local closest_distance, closest_enemy = math.huge
	for _, enemy in ipairs(entity.get_players(true)) do
		local head_position = enemy:get_hitbox_position(1)

		local ray_distance = head_position:dist_to_ray(
			camera_position, direction
		)
		
		if ray_distance < closest_distance then
			closest_distance = ray_distance
			closest_enemy = enemy
		end
	end

	if not closest_enemy then
		return
	end

	render.text(
		1,
		vector(screen_center.x, screen_center.y + 20),
		color(),
		"cd",
		string.format(
			"Closest enemy to crosshair: %s", closest_enemy:get_name()
		)
	)
end)
```

<figure><img src="/files/crGYZdIcfzQwEZpXYJhD" alt=""><figcaption><p>Preview</p></figcaption></figure>


# ESP

### Text Example

```lua
local low_health = 20

local text_example = esp.enemy:new_text("Text Example", "LOW HP", function(player)
	local health = player.m_iHealth
	if health > low_health then
		return
	end
	return "LOW HP"
end)

local group_ref = text_example:create()

local slider_ref = group_ref:slider("Low Health", 0, 50, low_health)

slider_ref:set_callback(function(slider_ref)
	low_health = slider_ref:get()
end, true)
```

<figure><img src="/files/Pal2AjfteJQnI7cR6Vk7" alt=""><figcaption></figcaption></figure>

### Bar Example

```lua
local bar_example = esp.enemy:new_bar("Bar Example", function(player)
	local velocity = player.m_vecVelocity
	local speed = velocity:length()
	if speed < 2 then
		return
	end

	local max_speed = 260
	local weapon = player:get_player_weapon()
	if weapon then
		max_speed = weapon:get_max_speed()
	end

	return speed / max_speed * 100
end)
```

### Item Example

```lua
local item_example = esp.enemy:new_item("Item Example")
local item_example_group_ref = item_example:create()
local switch_ref = item_example_group_ref:switch("Switch")

events.render:set(function()
	print(string.format("Item Example Selected: %s", item_example:get()))
	print(string.format("Switch Enabled: %s", switch_ref:get()))
end)
```


# ConVars

### Execute

> :information\_source: Force full-update
>
> :information\_source: Turn up player footstep volume

```lua
-- Initialize the cvar objects
local cl_fullupdate = cvar.cl_fullupdate
local snd_setmixer = cvar.snd_setmixer

-- Invoke the callback
cl_fullupdate:call()

-- Adjust players’ step volume by setting the mixer volume to 1.2
snd_setmixer:call('GlobalFootsteps', 'vol', 1.2)
```

### Getting / Setting values

> :information\_source: Override maximum fake-lag limit

```lua
-- Initialize the cvar objects
local process_ticks = cvar.sv_maxusrcmdprocessticks

-- [60]: New value | [true]: Sets the raw value
process_ticks:int(60, true)
```

### Callbacks

> :information\_source: Instantly crash the server if someones changes the <mark style="color:yellow;">`sv_cheats`</mark> cvar to 1
>
> :information\_source: Refuse the connection to the server if the IP is blacklisted

```lua
cvar.sv_cheats:set_callback(function(cvar_obj, old_value, new_value)
    if tonumber(old_value) == 0 and tonumber(new_value) == 1 then
        -- invoke ent_create convar callback with "weapon_ak47" argument
        -- cvar.ent_create:call 'weapon_ak47'

        cvar.clear:call()
        print '\aFF697Asv_cheats was updated. Crashing the server.'

        utils.console_exec 'ent_create weapon_ak47'
    end
end)

cvar.connect:set_callback(function(cvar_obj, args)
    if args[1] == '127.0.0.1' then
        return false
    end
end)
```


# UI

### UI Pseudocode

```lua
-- Pseudocode that shows most of the ui functions and how to use them

-- If you want to get a reference to an existing group or item, call .find
local double_tap_ref = ui.find("aimbot", "ragebot", "main", "double tap")

-- "ui.create" creates a group
-- in which you can add items such as switches, sliders, combos, etc.
local group_ref = ui.create("Group")

-- Some arguments can be optional, like the 2nd one in this function,
-- it will make its default value true
local switch_ref = group_ref:switch("Switch", true)

-- You can change its value
switch_ref:set(false)

-- Or you can "override" its value
-- This will allow you to change the value of the item
-- without changing its value in the menu or in the cheat's configuration
switch_ref:override(true)

-- Reset the previous override
switch_ref:override()

-- You can register a function that will be executed
-- every time the value of the item changes

-- The reference can be accessed from the arguments of the callback
switch_ref:set_callback(function(ref)
    -- You can access the value of the item by calling :get
    -- To access the value it's overriden to with :override, call :get_override
    print(string.format("New value: %s", ref:get()))
end)

-- If you want to what type of object the item is, you can call :get_type
-- print(switch_ref:type()) --> switch

-- You can attach other items to some types of items by calling :create
-- This will create and return a reference to the item group,
-- to which you can add other items
local switch_group_ref = switch_ref:create()

-- Our API offers a lot of overloads, you can either just provide a bunch of strings
-- or you can provide a table of strings
local combo_ref = switch_group_ref:combo("Combo", "Option A", "Option B", "Option C")

-- You can update the contents of combos, selectables, list, and listables with :update
combo_ref:update({"Option A"})

-- You can attach color pickers to some types of items,
-- but keep in mind that you won't be able to attach a group at the same time
local combo_color_picker_ref = combo_ref:color_picker(color(255, 0, 0, 255))

-- If you want to see what group the item belongs to, call :parent
-- print(group_ref == switch_ref:parent()) --> true
-- print(switch_group_ref == combo_ref:parent()) --> true

-- If you want to describe an item, you can call :tooltip,
-- which will display a text when you move the cursor over the item
switch_ref:tooltip("Some useful information.")

-- Further reading:
-- https://lua.neverlose.cc/documentation/variables/ui
-- DM Serene#1337 for any documentation errors
```

### Multi-Color Picker

```lua
-- create a group
local group_ref = ui.create("Example Group")

-- create a color picker in the group
local color_picker_ref = group_ref:color_picker("Example Color Picker", {
	["Simple"] = {
		color(255, 255, 255)
	},
	["Double"] = {
		color(255, 255, 255),
		color(0, 0, 0)
	},
	["Multiple"] = {
		color(255, 0, 0),
		color(0, 255, 0),
		color(0, 0, 255),
		color(255, 0, 255)
	},
})

-- print the available modes
for _, v in ipairs(color_picker_ref:list()) do
	print(v)

	-- [neverlose] Simple
	-- [neverlose] Multiple
	-- [neverlose] Double
end

events.render(function()
	-- get the currently selected mode and color(s)
	-- (the second returned value can be a table)
	local mode, colors = color_picker_ref:get()

	print(mode)

	-- get colors from a specific mode
	local top_left, top_right, bottom_left, bottom_right = unpack(color_picker_ref:get("Multiple"))

	render.gradient(
		vector(20, 20), vector(120, 120),
		top_left, top_right, bottom_left, bottom_right
	)
end)
```


# Events

List of cheat events that you can listen to using :set

## List of game events:

{% hint style="info" %}
In order to reference an event, index the `events` namespace with an event name
{% endhint %}

{% embed url="<https://wiki.alliedmods.net/Counter-Strike:_Global_Offensive_Events>" %}
Official CS:GO events
{% endembed %}

```lua
local hitgroup_str = {
    [0] = 'generic',
    'head', 'chest', 'stomach',
    'left arm', 'right arm',
    'left leg', 'right leg',
    'neck', 'generic', 'gear'
}

events.player_hurt:set(function(e)
    local me = entity.get_local_player()
    local attacker = entity.get(e.attacker, true)

    if me == attacker then
        local user = entity.get(e.userid, true)
        local hitgroup = hitgroup_str[e.hitgroup]

        print(('Hit %s in the %s for %d damage (%d health remaining)'):format(
            user:get_name(), hitgroup,
            e.dmg_health, e.health
        ))
    end
end)
```

## List of events:

### render

Fired every frame. Most functions from the [`render`](/documentation/variables/render) namespace can only be used here.

```lua
events.render:set(function(ctx)
    render.rect(vector(0, 0), vector(1920, 1080), color(230, 150))
end)
```

### render\_glow

Fired every time the game prepares glow object manager. This event gives you the ability to render glow lines. Access the function by adding an argument to the callback.

`ctx:render(from: vector, to: vector, thickness: number, flags: string, color: color)`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>from</strong></td><td><strong><code>vector</code></strong></td><td>Start position in world space</td></tr><tr><td><strong>to</strong></td><td><strong><code>vector</code></strong></td><td>Final position in world space</td></tr><tr><td><strong>thickness</strong></td><td><strong><code>number</code></strong></td><td>Line thickness as a number in the range [0.0, ∞]</td></tr><tr><td><strong>flags</strong></td><td><strong><code>string</code></strong></td><td>Glow flags. <mark style="color:blue;"><code>l</code></mark> to draw line, <mark style="color:blue;"><code>g</code></mark> to draw <code>glow</code> outline, or <mark style="color:blue;"><code>w</code></mark> to make it fully visible behind walls</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the line</td></tr></tbody></table>

<details>

<summary>🧷 Anti-aim direction glow lines</summary>

<img src="/files/BsYLpsc0YD19hxntIU3Q" alt="" data-size="original">

```lua
local real_yaw, abs_yaw = 0, 0

events.createmove:set(function(cmd)
    local me = entity.get_local_player()
    local anim_state = me:get_anim_state()

    if not anim_state or cmd.choked_commands > 0 then
        return
    end

    real_yaw = anim_state.eye_yaw
    abs_yaw = anim_state.abs_yaw
end)

events.render_glow:set(function(ctx)
    local me = entity.get_local_player()

    if not me or not me:is_alive() then
        return
    end

    local origin = me:get_origin()
    local real_yaw_dir = origin + (vector():angles(0, real_yaw) * 20)
    local abs_yaw_dir = origin + (vector():angles(0, abs_yaw) * 25)

    ctx:render(origin, real_yaw_dir, 0.15, 'lg', color(255, 0, 0)) -- Real yaw
    ctx:render(origin, abs_yaw_dir, 0.15, 'g', color(35, 215, 235)) -- Body yaw
end)
```

</details>

### override\_view

Fired every time the game prepares camera view.

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>fov</strong></td><td><strong><code>number</code></strong></td><td>Field of View</td></tr><tr><td><strong>view</strong></td><td><strong><code>vector</code></strong></td><td>Camera view angles</td></tr><tr><td><strong>camera</strong></td><td><strong><code>vector</code></strong></td><td>World position of the camera</td></tr></tbody></table>

### createmove

Fired every time the game prepares a move command. Use this to modify something before the aimbot or movement features. Use the parameter passed by the callback to access the [`UserCmd`](#struct-usercmd).

```lua
-- Sets the Roll angle when Shift (+speed) is being held
events.createmove:set(function(cmd)
    if cmd.in_speed then
        cmd.view_angles.z = 50 -- you are now unhittable
    end
end)
```

#### 🔗 struct <mark style="color:blue;">`UserCmd`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>block_movement</strong></td><td><strong><code>number</code></strong></td><td>Set to <mark style="color:blue;"><code>1</code></mark> to make the cheat slowdown you to the weapon's minimal speed or set to <mark style="color:blue;"><code>2</code></mark> to fully stop you. Defaults to <mark style="color:blue;"><code>0</code></mark></td></tr><tr><td><strong>no_choke</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>true</code></mark> to force the cheat to not choke the current command</td></tr><tr><td><strong>send_packet</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>false</code></mark> to force the cheat to choke the current command</td></tr><tr><td><strong>force_defensive</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>true</code></mark> to trigger <mark style="color:yellow;"><code>'defensive'</code></mark> exploit (Double tap is required to be fully charged)</td></tr><tr><td><strong>jitter_move</strong></td><td><strong><code>boolean</code></strong></td><td>Set to <mark style="color:blue;"><code>false</code></mark> to disable jitter move</td></tr><tr><td><strong>choked_commands</strong></td><td><strong><code>number</code></strong></td><td>Amount of choked commands</td></tr><tr><td><strong>command_number</strong></td><td><strong><code>number</code></strong></td><td>Current command number</td></tr><tr><td><strong>tickcount</strong></td><td><strong><code>number</code></strong></td><td>Current command tickcount</td></tr><tr><td><strong>random_seed</strong></td><td><strong><code>number</code></strong></td><td>Current command random seed</td></tr><tr><td><strong>view_angles</strong></td><td><strong><code>vector</code></strong></td><td>Player view angles</td></tr><tr><td><strong>move_yaw</strong></td><td><strong><code>number</code></strong></td><td>Movement yaw angle</td></tr><tr><td><strong>forwardmove</strong></td><td><strong><code>number</code></strong></td><td>Forward / backward speed</td></tr><tr><td><strong>sidemove</strong></td><td><strong><code>number</code></strong></td><td>Left / right speed</td></tr><tr><td><strong>upmove</strong></td><td><strong><code>number</code></strong></td><td>Up / down speed</td></tr></tbody></table>

<details>

<summary>🧷 Available cmd buttons</summary>

```lua
local on_createmove = function(cmd)
    cmd.in_attack -- +attack
    cmd.in_attack2 -- +attack2
    
    cmd.in_use -- +use
    cmd.in_jump -- +jump
    cmd.in_duck -- +duck
    cmd.in_walk -- +walk
    cmd.in_speed -- +speed
    cmd.in_reload -- +reload
    
    cmd.in_moveleft
    cmd.in_moveright
    cmd.in_forward
    cmd.in_back
    cmd.in_left
    cmd.in_right
    
    cmd.in_bullrush
end

events.createmove:set(on_createmove)
```

</details>

### createmove\_run

Fired every time the game runs a move command. Use the parameter passed by the callback to access the [`RunCommand`](#struct-usercmd-1).

#### 🔗 struct <mark style="color:blue;">`RunCommand`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>choked_commands</strong></td><td><strong><code>number</code></strong></td><td>Amount of choked commands</td></tr><tr><td><strong>command_number</strong></td><td><strong><code>number</code></strong></td><td>Current command number</td></tr><tr><td><strong>tick_count</strong></td><td><strong><code>number</code></strong></td><td>Current command tick count</td></tr><tr><td><strong>move_yaw</strong></td><td><strong><code>number</code></strong></td><td>Movement yaw angle</td></tr><tr><td><strong>forwardmove</strong></td><td><strong><code>number</code></strong></td><td>Forward / backward speed</td></tr><tr><td><strong>sidemove</strong></td><td><strong><code>number</code></strong></td><td>Left / right speed</td></tr><tr><td><strong>upmove</strong></td><td><strong><code>number</code></strong></td><td>Up / down speed</td></tr></tbody></table>

### aim\_fire

Fired every time the aimbot shoots at a player.

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>id</strong></td><td><strong><code>number</code></strong></td><td>Shot ID</td></tr><tr><td><strong>target</strong></td><td><strong><code>entity</code></strong></td><td>Target entity</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Estimated damage</td></tr><tr><td><strong>hitchance</strong></td><td><strong><code>number</code></strong></td><td>Estimated hit chance</td></tr><tr><td><strong>hitgroup</strong></td><td><strong><code>number</code></strong></td><td>Targeted hitgroup</td></tr><tr><td><strong>backtrack</strong></td><td><strong><code>number</code></strong></td><td>Amount of ticks the player was backtracked</td></tr><tr><td><strong>aim</strong></td><td><strong><code>vector</code></strong></td><td>World position of the aim point</td></tr><tr><td><strong>angle</strong></td><td><strong><code>vector</code></strong></td><td>Aimbot shoot angles</td></tr></tbody></table>

### aim\_ack

<table><thead><tr><th width="195.56818960672456">Name</th><th width="150">Type</th><th width="396.5818329607757">Description</th></tr></thead><tbody><tr><td><strong>id</strong></td><td><strong><code>number</code></strong></td><td>Shot ID</td></tr><tr><td><strong>target</strong></td><td><strong><code>entity</code></strong></td><td>Target entity</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Actual shot damage</td></tr><tr><td><strong>spread</strong></td><td><strong><code>number</code></strong></td><td>Bullet spread angle if available</td></tr><tr><td><strong>hitchance</strong></td><td><strong><code>number</code></strong></td><td>Actual shot hit chance</td></tr><tr><td><strong>hitgroup</strong></td><td><strong><code>number</code></strong></td><td>Hitgroup that was hit</td></tr><tr><td><strong>backtrack</strong></td><td><strong><code>number</code></strong></td><td>Amount of ticks the player was backtracked</td></tr><tr><td><strong>aim</strong></td><td><strong><code>vector</code></strong></td><td>World position of the aim point</td></tr><tr><td><strong>wanted_damage</strong></td><td><strong><code>number</code></strong></td><td>Targeted damage</td></tr><tr><td><strong>wanted_hitgroup</strong></td><td><strong><code>number</code></strong></td><td>Targeted hitgroup</td></tr><tr><td><strong>state</strong></td><td><strong><code>string</code></strong></td><td>Reason the shot was missed or nil if the shot was hit. Available miss reasons: <code>spread</code>, <code>correction</code>, <code>misprediction</code>, <code>prediction error</code>, <code>backtrack failure</code>, <code>damage rejection</code>, <code>unregistered shot</code>, <code>player death</code>, <code>death</code>.</td></tr></tbody></table>

### bullet\_fire

Fired every time someone fires a bullet.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that did the shot</td></tr><tr><td><strong>origin</strong></td><td><strong><code>vector</code></strong></td><td>Entity world position</td></tr><tr><td><strong>angles</strong></td><td><strong><code>vector</code></strong></td><td>Aim angle based on entity rotation</td></tr><tr><td><strong>sound</strong></td><td><strong><code>number</code></strong></td><td>Sound type</td></tr><tr><td><strong>spread</strong></td><td><strong><code>number</code></strong></td><td>Weapon spread</td></tr><tr><td><strong>inaccuracy</strong></td><td><strong><code>number</code></strong></td><td>Weapon inaccuracy</td></tr><tr><td><strong>recoil_index</strong></td><td><strong><code>number</code></strong></td><td>Weapon recoil index</td></tr><tr><td><strong>random_seed</strong></td><td><strong><code>number</code></strong></td><td>Spread seed of the shot</td></tr><tr><td><strong>weapon_id</strong></td><td><strong><code>number</code></strong></td><td>Weapon definition index</td></tr><tr><td><strong>weapon_mode</strong></td><td><strong><code>number</code></strong></td><td>Weapon fire mode</td></tr></tbody></table>

### console\_input

Fired every time the user runs a console command. Use the parameter passed by the callback to access the input string.

```lua
local last_random_int

events.console_input:set(function(text)
    if text == '/roll' then
        local random_int = utils.random_int(1, 6)

        local str = common.get_username() .. ' rolled a ' .. random_int
        if random_int == 1 and random_int == last_random_int then
            str = str .. '... snake eyes!'
        end

        print(str)

        last_random_int = random_int
        return false
    end
end)
```

This can be used to implement custom console commands. Return <mark style="color:purple;">`false`</mark> to prevent the game from processing the command.

### draw\_model

Fired before a model is rendered. Use the parameter passed by the callback to access the model context. Return <mark style="color:purple;">`false`</mark> to prevent the game from rendering the original model.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Name of the model. (e.g: <code>weapons\v_knife_cord.mdl</code>)</td></tr><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that belongs to the model.</td></tr><tr><td><strong>draw</strong></td><td><strong><code>function</code></strong></td><td>Draws the model with the specified material. Pass nil to the first argument to draw the model with the default material.</td></tr></tbody></table>

<details>

<summary>🧷 Draw model example</summary>

{% code lineNumbers="true" %}

```lua
local ct_fbi_glass = materials.get('models/player/ct_fbi/ct_fbi_glass', true)

events.draw_model:set(function(ctx)
    local me = entity.get_local_player()

    if ctx.entity == me then
        -- Override local player model with the new material
        ctx:draw(ct_fbi_glass)

        -- Prevent the game from drawing the original model
        return false
    end
end)
```

{% endcode %}

</details>

### level\_init

Fired after fully connected to the server (first non-delta packet received). (`SIGNONSTATE:FULL`)

### pre\_render

Fired before a frame is rendered. (`FrameStageNotify:FRAME_RENDER_START`)

### post\_render

Fired after a frame is rendered. (`FrameStageNotify:FRAME_RENDER_END`)

### net\_update\_start

Fired before the game processes entity updates from the server. (`FrameStageNotify:FRAME_NET_UPDATE_START`)

### net\_update\_end

Fired after an entity update packet is received from the server. (`FrameStageNotify:FRAME_NET_UPDATE_END`)

### config\_state

Fired every time config state is updated. The current state is accessible from the callback arguments as one of these strings: <mark style="color:blue;">`pre_save`</mark>, <mark style="color:blue;">`post_save`</mark>, <mark style="color:blue;">`pre_load`</mark>, <mark style="color:blue;">`post_load`</mark>.

{% code overflow="wrap" lineNumbers="true" %}

```lua
events.config_state(function(state)
    print(state == "pre_save")
end)
```

{% endcode %}

### mouse\_input

Fired every time the mouse input occurs. Return <mark style="color:purple;">`false`</mark> to lock the mouse input.

### shutdown

Fired when the script is about to unload.

### pre\_update\_clientside\_animation

Fired before C\_CSPlayer::UpdateClientSideAnimation is called.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>player</strong></td><td><strong><code>entity</code></strong></td><td>...</td></tr></tbody></table>

### post\_update\_clientside\_animation

Fired after C\_CSPlayer::UpdateClientSideAnimation is called.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>player</strong></td><td><strong><code>entity</code></strong></td><td>...</td></tr></tbody></table>

### grenade\_override\_view

Invoked to override the input values for the grenade prediction. Contains detailed view parameters associated with the grenade trajectory prediction.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>angles</strong></td><td><strong><code>vector</code></strong></td><td>Input view angles</td></tr><tr><td><strong>src</strong></td><td><strong><code>vector</code></strong></td><td>Input starting position or origin</td></tr><tr><td><strong>velocity</strong></td><td><strong><code>vector</code></strong></td><td>Input velocity</td></tr><tr><td><strong>view_offset</strong></td><td><strong><code>vector</code></strong></td><td>Input view offset</td></tr></tbody></table>

### grenade\_warning

Fired when the "Grenade Proximity Warning" is being rendered. Return `false` to it from being rendered.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>The game entity representing the grenade in proximity.</td></tr><tr><td><strong>origin</strong></td><td><strong><code>vector</code></strong></td><td>The current position of the grenade.</td></tr><tr><td><strong>closest_point</strong></td><td><strong><code>vector</code></strong></td><td>Represents the nearest point to the player where the grenade will cause damage. For example, in the case of a molotov, this point indicates where the flames would be most harmful.</td></tr><tr><td><strong>type</strong></td><td><strong><code>string</code></strong></td><td>Specifies the type of the grenade, "Frag" or "Molly".</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Predicts the potential damage that would be inflicted upon the local player if they remain at their current position when the grenade detonates.</td></tr><tr><td><strong>expire_time</strong></td><td><strong><code>number</code></strong></td><td>Specifies the time when the grenade detonates or is no longer a threat.</td></tr><tr><td><strong>icon</strong></td><td><strong><code>ImgObject</code></strong></td><td>A reference to the texture used in the warning.</td></tr><tr><td><strong>path</strong></td><td><strong><code>table</code></strong></td><td>Table of 3D vectors representing the complete trajectory path of the grenade.</td></tr></tbody></table>

### grenade\_prediction

Fired when the cheat is drawing the predicted grenade trajectory. Contains detailed information about the grenade's trajectory and impact.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>type</strong></td><td><strong><code>string</code></strong></td><td>Identifies the type of the grenade, e.g., "Smoke", "Flash", "Frag".</td></tr><tr><td><strong>damage</strong></td><td><strong><code>number</code></strong></td><td>Represents the amount of damage inflicted upon the <code>target</code> due to the grenade's effect.</td></tr><tr><td><strong>fatal</strong></td><td><strong><code>boolean</code></strong></td><td>Indicates whether the grenade's effect resulted in a lethal outcome for the <code>target</code>.</td></tr><tr><td><strong>path</strong></td><td><strong><code>table</code></strong></td><td>Table of 3D vectors representing the complete trajectory path of the grenade.</td></tr><tr><td><strong>collisions</strong></td><td><strong><code>table</code></strong></td><td>Table of 3D vectors containing all the collision points where the grenade interacts with an obstacle or wall.</td></tr><tr><td><strong>target</strong></td><td><strong><code>entity</code></strong></td><td>The game entity that the grenade directly impacts or affects.</td></tr></tbody></table>

### localplayer\_transparency

Invoked to override the opacity of the local player's model. You can override it by returning a custom alpha value.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>current_alpha</strong></td><td><strong><code>number</code></strong></td><td>The current alpha. Ranges from 0 (completely transparent) to 255 (completely opaque).</td></tr></tbody></table>

## List of complicated events:

### voice\_message

Fired every time the game receives a voice packet.

<table><thead><tr><th width="171.8641738241271">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that belongs to the voice packet.</td></tr><tr><td><strong>audible_mask</strong></td><td><strong><code>number</code></strong></td><td>Audible mask</td></tr><tr><td><strong>xuid</strong></td><td><strong><code>number</code></strong></td><td>Xuid</td></tr><tr><td><strong>proximity</strong></td><td><strong><code>number</code></strong></td><td>Proximity</td></tr><tr><td><strong>format</strong></td><td><strong><code>number</code></strong></td><td>Format</td></tr><tr><td><strong>sequence_bytes</strong></td><td><strong><code>number</code></strong></td><td>Sequence bytes</td></tr><tr><td><strong>section_number</strong></td><td><strong><code>number</code></strong></td><td>Section number</td></tr><tr><td><strong>uncompressed_sample_offset</strong></td><td><strong><code>number</code></strong></td><td>Uncompressed sample offset</td></tr><tr><td><strong>buffer</strong></td><td><strong><code>bf_read</code></strong></td><td>Voice packet buffer</td></tr><tr><td><strong>is_nl</strong></td><td><strong><code>boolean</code></strong></td><td>Packet was sent by the Neverlose</td></tr></tbody></table>

#### 🔗 struct <mark style="color:blue;">`bf_read`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>read_bits</strong></td><td><strong><code>function</code></strong></td><td>Reads a number value from the buffer <code>:read_bits(num_bits)</code></td></tr><tr><td><strong>read_coord</strong></td><td><strong><code>function</code></strong></td><td>Reads a floating number value from the buffer <code>:read_coord()</code> (4 bytes)</td></tr><tr><td><strong>reset</strong></td><td><strong><code>function</code></strong></td><td>Resets the pointer of the buffer to its original offset</td></tr><tr><td><strong>crypt</strong></td><td><strong><code>function</code></strong></td><td>Encrypts/decrypts buffer <code>:crypt(key)</code></td></tr></tbody></table>

#### 🔗 struct <mark style="color:blue;">`bf_write`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>write_bits</strong></td><td><strong><code>function</code></strong></td><td>Writes a number value to the buffer <code>:write_bits(value, num_bits)</code></td></tr><tr><td><strong>write_coord</strong></td><td><strong><code>function</code></strong></td><td>Writes a floating number value to the buffer <code>:write_coord(value)</code> (4 bytes)</td></tr><tr><td><strong>is_overflowed</strong></td><td><strong><code>function</code></strong></td><td>Returns <mark style="color:blue;"><code>true</code></mark> if the buffer is overflowed</td></tr><tr><td><strong>crypt</strong></td><td><strong><code>function</code></strong></td><td>Encrypts/decrypts buffer <code>:crypt(key)</code></td></tr></tbody></table>

> 📌 Firing this event from the Lua will send a voice packet
>
> `events.voice_message(function: buffer)`

```lua
events.voice_message(function(ctx)
    local buffer = ctx.buffer
    local code = buffer:read_bits(16)

    if code ~= 0x1337 then
        return
    end

    local tickcount = buffer:read_bits(32)

    print(string.format(
        'received voice packet from %s | pct_tickcount: %d',
        ctx.entity:get_name(), tickcount
    ))
end)

-- Note that you wont be able to receive your own voice packet
-- unless voice_loopback convar is set to 1
events.voice_message:call(function(buffer)
    buffer:write_bits(0x1337, 16)
    buffer:write_bits(globals.tickcount, 32)
end)
```

> `[neverlose] received voice packet from Salvatore | pct_tickcount: 1200`


# Variables


# \_G

### assert

`assert(expression: any[, text: string, ...]): any`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>expression</strong></td><td><strong><code>any</code></strong></td><td>The expression to assert.</td></tr><tr><td><strong>text</strong></td><td><strong><code>text</code></strong></td><td>The error message to throw when assertion fails. This is only type-checked if the assertion fails.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Any arguments past the error message will be returned by a successful assert.</td></tr></tbody></table>

If the result of the first argument is false or nil, an error is thrown with the second argument as the message.

### error

`error(text: any[, level: number])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>The error message to throw.</td></tr><tr><td><strong>level</strong></td><td><strong><code>number</code></strong></td><td>The level to throw the error at.</td></tr></tbody></table>

Throws a Lua error and breaks out of the current call stack.

### getmetatable

`getmetatable(object: any): any`

<table><thead><tr><th width="158">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>object</strong></td><td><strong><code>any</code></strong></td><td>The value to return the metatable of.</td></tr></tbody></table>

Returns the metatable of an object. This function obeys the metatable's \_\_metatable field, and will return that field if the metatable has it set.

### ipairs

`ipairs(tbl: table): function, table, number`

<table><thead><tr><th width="165">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>tbl</strong></td><td><strong><code>table</code></strong></td><td>The table to iterate over.</td></tr></tbody></table>

Returns an iterator function for a for loop, to return ordered key-value pairs from a table.

### print

`print(text: string[, ...])`

<table><thead><tr><th width="177.60767828800178">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text to print into the console.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Optional arguments to concatenate with <code>text</code>.</td></tr></tbody></table>

Prints the text to the console.

### print\_error

`print_error(text: string[, ...])`

<table><thead><tr><th width="177.60767828800178">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text to print into the console.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Optional arguments to concatenate with <code>text</code>.</td></tr></tbody></table>

Prints an error to the console and plays a sound.

### print\_chat

`print_chat(text: string[, ...])`

<table><thead><tr><th width="182.60767828800178">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text to print into the in-game chat.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Optional arguments to concatenate with <code>text</code>.</td></tr></tbody></table>

Prints the text to the in-game chat.

### print\_raw

`print_raw(text: string[, ...])`

<table><thead><tr><th width="176">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text to print into the console.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Optional arguments to concatenate with <code>text</code>.</td></tr></tbody></table>

Prints the text that can be changed in color by prepending it with `"\a"` followed by the color in the hexadecimal "RRGGBB" format. For example, `"\aFF0000Hi"` will print `"Hi"` in red.

### print\_dev

`print_dev(text: string[, ...])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text to print to into the upper-left console panel.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Optional arguments to concatenate with <code>text</code>.</td></tr></tbody></table>

Prints the text into the upper-left console panel.

### tonumber

`tonumber(value: any[, base: number]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>The value to convert. Can be a number or string.</td></tr><tr><td><strong>base</strong></td><td><strong><code>number</code></strong></td><td>Optional. The base used in the string. Can be any integer between 2 and 36, inclusive.</td></tr></tbody></table>

Returns the numeric representation of the value with the given base, or <mark style="color:purple;">`nil`</mark> if the conversion failed.

### tostring

`tostring(var: any):` <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>var</strong></td><td><strong><code>any</code></strong></td><td>The object to be converted to a string.</td></tr></tbody></table>

Returns the string representation of the value.

### type

`type(var: any):` <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>var</strong></td><td><strong><code>any</code></strong></td><td>The object to get the type of.</td></tr></tbody></table>

Returns the name of the object's type.

### unpack

`unpack(tbl: table, start_index: number, end_index: number):` <mark style="color:purple;">`...`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>tbl</strong></td><td><strong><code>table</code></strong></td><td>The table to generate the vararg from.</td></tr><tr><td><strong>start_index</strong></td><td><strong><code>number</code></strong></td><td>Which index to start from. Optional.</td></tr><tr><td><strong>end_index</strong></td><td><strong><code>number</code></strong></td><td>Which index to end at. Optional, even if you set <code>start_index</code>.</td></tr></tbody></table>

### xpcall

`xpcall(func: function, err_callback: function[, ...]):` <mark style="color:purple;">`boolean`</mark>, <mark style="color:purple;">`...`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>func</strong></td><td><strong><code>function</code></strong></td><td>The function to call initially.</td></tr><tr><td><strong>err_callback</strong></td><td><strong><code>function</code></strong></td><td>The function to be called if execution of the first fails. The error message is passed as a string.</td></tr><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td>Arguments to pass to the initial function.</td></tr></tbody></table>

Attempts to call the first function. If the execution succeeds, this returns <mark style="color:purple;">`true`</mark> followed by the returns of the function. If execution fails, this returns <mark style="color:purple;">`false`</mark> and the second function is called with the error message.

### to\_ticks

`to_ticks(time: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>time</strong></td><td><strong><code>number</code></strong></td><td>The seconds to convert to ticks.</td></tr></tbody></table>

Converts time (seconds) to ticks.

### to\_time

`to_time(ticks: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>ticks</strong></td><td><strong><code>number</code></strong></td><td>The number of ticks to convert to time.</td></tr></tbody></table>

Converts ticks to time (seconds).

### new\_class

> ℹ️ This class system makes it easier to structure code in complex projects.

`new_class():` <mark style="color:purple;">`metatable`</mark>

Creates the new class.

{% tabs %}
{% tab title="Example1" %}
{% code overflow="wrap" %}

```lua
local ctx = new_class()
    :struct 'struct_one' {
        variable1 = 'test',
        
        some_function = function(self, arg1)
            print(arg1)
            print(string.format('Hello World (%s)', self.variable1))
        end
    }
    
ctx.struct_one:some_function('test')
```

{% endcode %}
{% endtab %}

{% tab title="Example2" %}

> You can also create multiple structs and access one from another.

```lua
local ctx = new_class()
    :struct 'struct_one' {
        variable = 1,

        some_function = function(self)
            print(string.format(
                'variable from struct_two: %d', 
                self.struct_two.variable
            ))
        end
    }
    
    :struct 'struct_two' {
        variable = 2,
        
        some_function = function(self)
            print(string.format(
                'variable from struct_one: %d', 
                self.struct_one.variable
            ))
        end
    }

ctx.struct_two:some_function()
ctx.struct_one:some_function()

print(ctx.struct_one.variable)
```

{% endtab %}
{% endtabs %}


# bit

## Functions:

### arshift

`bit.arshift(x: number, n: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number of bits</td></tr></tbody></table>

Returns the bitwise arithmetic right-shift of its first argument by the number of bits given by the second argument. Arithmetic right-shift treats the most-significant bit as a sign bit and replicates it. Only the lower 5 bits of the shift count are used (reduces to the range \[0..31]).

### band

`bit.band(x1: number, x2: number[, ...]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x1</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>x2</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>...</strong></td><td></td><td>Number(s)</td></tr></tbody></table>

Returns the bitwise and of all of its arguments. Note that more than two arguments are allowed.

### bnot

`bit.bnot(x: number)`: number

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the bitwise not of its argument.

### bor

`bit.bor(x1: number, x2: number[, ...]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x1</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>x2</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>...</strong></td><td></td><td>Number(s)</td></tr></tbody></table>

Returns the bitwise or of all of its arguments. Note that more than two arguments are allowed.

### bswap

`bit.bswap(x: number):` number

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Swaps the bytes of its argument and returns it. This can be used to convert little-endian 32 bit numbers to big-endian 32 bit numbers or vice versa.

### bxor

`bit.bxor(x1: number, [x2...]: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x1</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>[x2...]</strong></td><td><strong><code>number</code></strong></td><td>Number(s)</td></tr></tbody></table>

Returns the bitwise xor of all of its arguments. Note that more than two arguments are allowed.

### lshift

`bit.lshift(x: number, n: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number of bits</td></tr></tbody></table>

Returns the bitwise logical left-shift of its first argument by the number of bits given by the second argument. Logical shifts treat the first argument as an unsigned number and shift in 0-bits. Only the lower 5 bits of the shift count are used (reduces to the range \[0..31]).

### rol

`bit.rol(x: number, n: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number of bits</td></tr></tbody></table>

Returns the bitwise left rotation of its first argument by the number of bits given by the second argument. Bits shifted out on one side are shifted back in on the other side. Only the lower 5 bits of the rotate count are used (reduces to the range \[0..31]).

### ror

`bit.ror(x: number, n: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number of bits</td></tr></tbody></table>

Returns the bitwise right rotation of its first argument by the number of bits given by the second argument. Bits shifted out on one side are shifted back in on the other side. Only the lower 5 bits of the rotate count are used (reduces to the range \[0..31]).

### rshift

`bit.rshift(x: number, n: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number of bits</td></tr></tbody></table>

Returns the bitwise logical right-shift of its first argument by the number of bits given by the second argument. Logical shifts treat the first argument as an unsigned number and shift in 0-bits. Only the lower 5 bits of the shift count are used (reduces to the range \[0..31]).

### tobit

`bit.tobit(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number to normalize</td></tr></tbody></table>

Normalizes a number to the numeric range for bit operations and returns it. This function is usually not needed since all bit operations already normalize all of their input arguments.

### tohex

`bit.tohex(x: number, n: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number to convert</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number of hex digits to return</td></tr></tbody></table>

Converts its first argument to a hex string. The number of hex digits is given by the absolute value of the optional second argument. Positive numbers between 1 and 8 generate lowercase hex digits. Negative numbers generate uppercase hex digits. Only the least-significant 4\*|n| bits are used. The default is to generate 8 lowercase hex digits.


# color

## Example available!

{% content-ref url="/pages/QT7Qd1VML9Wg3yHGNrMz" %}
[Color](/useful-information/script-examples/color)
{% endcontent-ref %}

## Functions:

### :clone

`color_object:clone():` <mark style="color:purple;">`color`</mark>

Creates and returns a copy of the color object.

### :init

{% tabs %}
{% tab title="RGBA" %}
`color_object:init(r: number, g: number, b: number, a: number):` <mark style="color:purple;">`color`</mark>

> 📌 Available overloads (`RGBA`):\
> color() -> `255`, `255`, `255`, `255`\
> color(<mark style="color:blue;">`200`</mark>) -> <mark style="color:blue;">`200`</mark>, <mark style="color:blue;">`200`</mark>, <mark style="color:blue;">`200`</mark>, `255`\
> color(<mark style="color:blue;">`255`</mark>, <mark style="color:yellow;">`160`</mark>) -> <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`255`</mark>, <mark style="color:yellow;">`160`</mark>\
> color(<mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`195`</mark>, <mark style="color:blue;">`25`</mark>) -> <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`195`</mark>, <mark style="color:blue;">`25`</mark>, `255`\
> color(<mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`195`</mark>, <mark style="color:blue;">`25`</mark>, <mark style="color:blue;">`200`</mark>) -> <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`195`</mark>, <mark style="color:blue;">`25`</mark>, <mark style="color:blue;">`200`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>r</strong></td><td><strong><code>number</code></strong></td><td>New R color range</td></tr><tr><td><strong>g</strong></td><td><strong><code>number</code></strong></td><td>New G color range</td></tr><tr><td><strong>b</strong></td><td><strong><code>number</code></strong></td><td>New B color range</td></tr><tr><td><strong>a</strong></td><td><strong><code>number</code></strong></td><td>New A color range</td></tr></tbody></table>
{% endtab %}

{% tab title="HEX" %}
`color_object:init(value: string):` <mark style="color:purple;">`color`</mark>

> 📌 Available overloads (`HEX` -> `RGBA`):\
> color '<mark style="color:blue;">`C8`</mark>' -> <mark style="color:blue;">`200`</mark>, <mark style="color:blue;">`200`</mark>, <mark style="color:blue;">`200`</mark>, `255`\
> color '<mark style="color:blue;">`FF`</mark><mark style="color:yellow;">`A0`</mark>' -> <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`255`</mark>, <mark style="color:yellow;">`160`</mark>\
> color '<mark style="color:blue;">`FFC319`</mark>' -> <mark style="color:blue;">`255`</mark>, <mark style="color:blue;">`195`</mark>, <mark style="color:blue;">`25`</mark>, `255`\
> color '<mark style="color:blue;">`AABBCCDD`</mark>' -> <mark style="color:blue;">`170`</mark>, <mark style="color:blue;">`187`</mark>, <mark style="color:blue;">`204`</mark>, <mark style="color:blue;">`221`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>string</code></strong></td><td>HEX string value (Format: <mark style="color:blue;"><code>AABBCCDD</code></mark> including all available overloads)</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Overwrites the color's ranges. Returns itself.

### :as\_fraction

`color_object:as_fraction(r: number, g: number, b: number, a: number):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>r</strong></td><td><strong><code>number</code></strong></td><td>New R color range as a percentage in the range [0.0, 1.0]</td></tr><tr><td><strong>g</strong></td><td><strong><code>number</code></strong></td><td>New G color range as a percentage in the range [0.0, 1.0]</td></tr><tr><td><strong>b</strong></td><td><strong><code>number</code></strong></td><td>New B color range as a percentage in the range [0.0, 1.0]</td></tr><tr><td><strong>a</strong></td><td><strong><code>number</code></strong></td><td>New A color range as a percentage in the range [0.0, 1.0]</td></tr></tbody></table>

Overwrites the color's ranges using the fraction values. Returns itself.

### :as\_int32

`color_object:as_int32(value: number):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>int32 color value</td></tr></tbody></table>

Overwrites the color's ranges converting the int32 value to RGBA values. Returns itself.

### :as\_hsv

`color_object:as_hsv(h: number, s: number, v: number, a: number):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>h</strong></td><td><strong><code>number</code></strong></td><td>Hue color range [0.0, 1.0]</td></tr><tr><td><strong>s</strong></td><td><strong><code>number</code></strong></td><td>Saturation color range [0.0, 1.0]</td></tr><tr><td><strong>v</strong></td><td><strong><code>number</code></strong></td><td>Value color range [0.0, 1.0]</td></tr><tr><td><strong>a</strong></td><td><strong><code>number</code></strong></td><td>Alpha color range [0.0, 1.0]</td></tr></tbody></table>

Overwrites the color's ranges converting the HSV to RGBA values. Returns itself.

### :as\_hsl

`color_object:as_hsl(h: number, s: number, l: number, a: number):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>h</strong></td><td><strong><code>number</code></strong></td><td>Hue color range [0.0, 1.0]</td></tr><tr><td><strong>s</strong></td><td><strong><code>number</code></strong></td><td>Saturation color range [0.0, 1.0]</td></tr><tr><td><strong>l</strong></td><td><strong><code>number</code></strong></td><td>Lightness color range [0.0, 1.0]</td></tr><tr><td><strong>a</strong></td><td><strong><code>number</code></strong></td><td>Alpha color range [0.0, 1.0]</td></tr></tbody></table>

Overwrites the color's ranges converting the HSL to RGBA values. Returns itself.

### :to\_fraction

`color_object:to_fraction():` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

Returns the r, g, b, and a ranges of the color as a percentage in the range of \[0.0, 1.0].

### :to\_hex

`color_object:to_hex():` <mark style="color:purple;">`string`</mark>

Returns the HEX string representing the color.

### :to\_int32

`color_object:to_int32():` <mark style="color:purple;">`number`</mark>

Returns the int32 value representing the color.

### :to\_hsv

`color_object:to_hsv():` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

Returns the HSV representation of the color.

### :to\_hsl

`color_object:to_hsl():` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

Returns the HSL representation of the color.

### :lerp

`color_object:lerp(other: color, weight: number):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>color</code></strong></td><td>The color to interpolate to</td></tr><tr><td><strong>weight</strong></td><td><strong><code>number</code></strong></td><td>A value between 0 and 1 that indicates the weight of <strong>other</strong></td></tr></tbody></table>

Returns the linearly interpolated color between two colors by the specified weight.

### :grayscale

`color_object:grayscale([ weight: number ]):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>weight</strong></td><td><strong><code>number</code></strong></td><td>Optional. A value between 0 and 1 that indicates the weight of <strong>grayscale</strong></td></tr></tbody></table>

Returns the grayscaled color.

### :alpha\_modulate

`color_object:alpha_modulate(alpha: number):` <mark style="color:purple;">`color`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>alpha</strong></td><td><strong><code>number</code></strong></td><td>Alpha color range [0, 255]</td></tr></tbody></table>

Returns the current color with an overridden Alpha color range.

### :unpack

`color_object:unpack():` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

Returns the r, g, b, and a values of the color. Note that these fields can be accessed by indexing r, g, b, and a.


# common

## Functions:

### get\_date

{% embed url="<https://devhints.io/datetime>" %}

`common.get_date(format: string[, unix_time: number]):` <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>format</strong></td><td><strong><code>string</code></strong></td><td>Date format (<code>strftime</code>)</td></tr><tr><td><strong>unix_time</strong></td><td><strong><code>number</code></strong></td><td>Optional. Unix-format time</td></tr></tbody></table>

Returns the formatted date.

### get\_unixtime

`common.get_unixtime():` <mark style="color:purple;">`number`</mark>

Returns the number of seconds that have elapsed since the unix epoch (1 January 1970 00:00:00)

### get\_timestamp

`common.get_timestamp():` <mark style="color:purple;">`number`</mark>

Returns high precision timestamp in milliseconds.

### get\_system\_time

`common.get_system_time():` <mark style="color:purple;">`table`</mark>

Returns the windows time as a table containing the <mark style="color:blue;">`year`</mark>, <mark style="color:blue;">`month`</mark>, <mark style="color:blue;">`day`</mark>, <mark style="color:blue;">`hours`</mark>, <mark style="color:blue;">`minutes`</mark>, and <mark style="color:blue;">`seconds`</mark> values.

### get\_product\_version

`common.get_product_version():` <mark style="color:purple;">`number`</mark>

Returns the product version of the game client.

### get\_game\_directory

`common.get_game_directory():` <mark style="color:purple;">`string`</mark>

Returns the path to the game client folder.

### get\_map\_data

`common.get_map_data():` <mark style="color:purple;">`table`</mark>

Returns a table containing the <mark style="color:blue;">`name`</mark>, <mark style="color:blue;">`shortname`</mark>, and <mark style="color:blue;">`group`</mark> values.

### get\_username

`common.get_username():` <mark style="color:purple;">`string`</mark>

Returns your Neverlose username.

### get\_config\_name

`common.get_config_name():` <mark style="color:purple;">`string`</mark>

Returns the name of the currently loaded config.

### get\_active\_scripts

`common.get_active_scripts():` <mark style="color:purple;">`table`</mark>

Returns a table of strings containing the names of the loaded scripts.

### get\_mouse\_wheel\_delta

`common.get_mouse_wheel_delta():` <mark style="color:purple;">`number`</mark>

Returns a value that indicates the amount that the mouse wheel has changed.

### is\_in\_thirdperson

`common.is_in_thirdperson():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the camera is in thirdperson.

### reload\_script

`common.reload_script()`

Reloads current script.

### unload\_script

`common.unload_script()`

Unloads current script.

### force\_full\_update

`common.force_full_update()`

Forces the server to send a full update packet.

### set\_clan\_tag

`common.set_clan_tag(text: string)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>New clan tag</td></tr></tbody></table>

Sets your in-game clan tag.

### set\_name

`common.set_name(text: string)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>New name</td></tr></tbody></table>

Sets your in-game name.

### add\_event

`common.add_event(text: string[, icon_name: string])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text to print to into the upper-left panel.</td></tr><tr><td><strong>icon_name</strong></td><td><strong><code>string</code></strong></td><td>Optional. Fontawesome icon name.</td></tr></tbody></table>

Prints the text into the upper-left neverlose event panel.

### add\_notify

`common.add_notify(title: string, text: string)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>title</strong></td><td><strong><code>string</code></strong></td><td>Text to print to into the title.</td></tr><tr><td><strong>body</strong></td><td><strong><code>string</code></strong></td><td>Text to print to into the body of the notification.</td></tr></tbody></table>

Draws the notification.

### is\_button\_down

{% embed url="<https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes>" %}

`common.is_button_down(key: number):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong><code>number</code></strong></td><td>Key to check</td></tr></tbody></table>

Returns <mark style="color:green;">`true`</mark> if the button is down, or nil on failure.

### is\_button\_released

`common.is_button_released(key: number):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong><code>number</code></strong></td><td>Key to check</td></tr></tbody></table>

Returns <mark style="color:green;">`true`</mark> if the button is released, or nil on failure.


# cvar

### Example

```lua
cvar.mp_teammates_are_enemies:int(1)
cvar.clear:call()
```

## Functions:

### :call

`cvar_object:call(...)`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td>...</td><td></td><td>Arguments passed to the callback</td></tr></tbody></table>

Executes a ConCommand or cvar callback, passing its arguments to it.

### :int

{% tabs %}
{% tab title="Get value" %}
`cvar_object:int():` <mark style="color:purple;">`number`</mark>
{% endtab %}

{% tab title="Set value" %}
`cvar_object:int(value: number[, raw: boolean ])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>New int value</td></tr><tr><td><strong>raw</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark> then the <code>raw</code> value will be set</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Gets or sets the ConVar int value.

### :float

{% tabs %}
{% tab title="Get value" %}
`cvar_object:float():` <mark style="color:purple;">`number`</mark>
{% endtab %}

{% tab title="Set value" %}
`cvar_object:float(value: number[, raw: boolean ])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>New float value</td></tr><tr><td><strong>raw</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark> then the <code>raw</code> value will be set</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Gets or sets the ConVar float value.

### :string

`cvar_object:string([ value: any ]):` <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>New string value. If not specified then returns the string value of the ConVar</td></tr></tbody></table>

Gets or sets the ConVar string value.

### :set\_callback

{% tabs %}
{% tab title="ConVar" %}
You can access the `cvar_object`, `old_value` and `new_value` by adding them to the function arguments.
{% endtab %}

{% tab title="Command" %}
You can access the `cvar_object` and `args` by adding them to the function arguments. Inside the callback, return false to prevent the command from being executed.
{% endtab %}
{% endtabs %}

`cvar_object:set_callback(callback: function)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Lua function to call</td></tr></tbody></table>

Registers the callback to the specified ConVar/Command. The registered function will be called every time the specified convar value is updated.

### :unset\_callback

`cvar_object:unset_callback(callback: function)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Lua function that was passed to the <mark style="color:purple;"><code>:set_callback</code></mark> function</td></tr></tbody></table>

Unregisters the callback that was set via the <mark style="color:purple;">`:set_callback`</mark> function from the specified ConVar/Command.


# db

### Utilizing database

`db.key_name:` <mark style="color:purple;">`any`</mark>

`db.key_name = value`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>key_name</strong></td><td><strong><code>any</code></strong></td><td>Name of the key</td></tr><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>Value the key should be set to. This can be anything that can be sanitized (no functions, userdata)</td></tr></tbody></table>

{% hint style="warning" %}
Indexing database keys is a heavy process. Do not do it inside callbacks that are called a lot of times per second.
{% endhint %}

```lua
-- look up for database key named "test"
-- returns the new table if database returned nil
local data = db.test or { }

data.name = 'Salvatore'
data.project = 'Spirthack Innovations LLC'

events.shutdown:set(function()
    -- replace "test" key with the new value
    db.test = data
end)
```


# entity

## Functions:

### get

`entity.get(idx: number[, by_userid: boolean]):` <mark style="color:purple;">`entity`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>idx</strong></td><td><strong><code>number</code></strong></td><td>Index of the entity</td></tr><tr><td><strong>by_userid</strong></td><td><strong><code>boolean</code></strong></td><td>If <mark style="color:purple;"><code>true</code></mark> then <strong>idx</strong> will be perceived as a userid</td></tr></tbody></table>

Returns a pointer to the specified entity.

### get\_local\_player

`entity.get_local_player():` <mark style="color:purple;">`entity`</mark>

Returns a pointer to the local player.

### get\_players

`entity.get_players([enemies_only: boolean, include_dormant: boolean, callback: function]):`<mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="194.71365870421369">Name</th><th width="150">Type</th><th width="366.77253218884124">Description</th></tr></thead><tbody><tr><td><strong>enemies_only</strong></td><td><strong><code>boolean</code></strong></td><td>If <mark style="color:purple;"><code>true</code></mark> then only enemies will be included</td></tr><tr><td><strong>include_dormant</strong></td><td><strong><code>boolean</code></strong></td><td>If <mark style="color:purple;"><code>true</code></mark> then dormant players will be included</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>A callback with an entity pointer as the argument</td></tr></tbody></table>

If the callback is nil, it returns the table of pointers to player entities. Otherwise the callback will be called. Access the player pointer using the arguments of the specified callback.

### get\_entities

`entity.get_entities([class: number/string, include_dormant: boolean, callback: function]):` <mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="194.71365870421369">Name</th><th width="165.84833781820578">Type</th><th width="366.77253218884124">Description</th></tr></thead><tbody><tr><td><strong>class</strong></td><td><strong><code>number/string</code></strong></td><td>Either a name or an ID of the needed class. Pass <mark style="color:purple;"><code>nil</code></mark> to get every entity.</td></tr><tr><td><strong>include_dormant</strong></td><td><strong><code>boolean</code></strong></td><td>If <mark style="color:purple;"><code>true</code></mark> then dormant players will be included</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>A callback with an entity pointer as the argument</td></tr></tbody></table>

If the callback is nil, it returns the table of pointers to entities. Otherwise the callback will be called. Access the entity pointer using the arguments of the specified callback.

### get\_threat

`entity.get_threat([ hittable: boolean ]):` <mark style="color:purple;">`entity`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>hittable</strong></td><td><strong><code>boolean</code></strong></td><td>If <mark style="color:purple;"><code>true</code></mark> then returns a pointer to the player that can hit you</td></tr></tbody></table>

Returns a pointer to the current threat.

### get\_game\_rules

`entity.get_game_rules():` <mark style="color:purple;">`entity`</mark>

Returns the pointer to the CCSGameRulesProxy instance, or nil if none exists.

### get\_player\_resource

`entity.get_player_resource():` <mark style="color:purple;">`entity`</mark>

Returns the pointer to the CCSPlayerResource instance, or nil if none exists.

## Netprops

### Getting FFI pointer

`ent[0]` `:` <mark style="color:purple;">`userdata`</mark>

Returns the <mark style="color:yellow;">`ffi`</mark> pointer to the entity.

### Getting netprop values

`ent.prop_name:` <mark style="color:purple;">`any`</mark>

`ent.prop_name[index]:` <mark style="color:purple;">`any`</mark>

`ent["prop_name"]:` <mark style="color:purple;">`any`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>prop_name</strong></td><td><strong><code>string</code></strong></td><td>Name of the networked property</td></tr><tr><td><strong>index</strong></td><td><strong><code>number</code></strong></td><td>Optional. If <code>prop_name</code> is an array, the value at this array index will be returned</td></tr></tbody></table>

```lua
local on_createmove = function(cmd)
    local localplayer = entity.get_local_player()
    
    if localplayer == nil then
        return
    end
    
    -- example 1
    local health = localplayer.m_iHealth

    -- example 2 [array netprops]
    local pitch = localplayer.m_flPoseParameter[12]

    -- example 3
    local stamina = localplayer['m_flStamina']
    
    print(('my health is: %d | pitch: %.1f | stamina: %d%%'):format(
        health, pitch,
        100 - (80 / 100 * stamina)
    ))
end

events.createmove:set(on_createmove)
```

### Setting netprop values

`ent.prop_name = value`

`ent.prop_name[index] = value`

`ent["prop_name"] = value`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>prop_name</strong></td><td><strong><code>string</code></strong></td><td>Name of the networked property</td></tr><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>The property will be set to this value</td></tr><tr><td><strong>index</strong></td><td><strong><code>number</code></strong></td><td>Optional. If <code>prop_name</code> is an array, the value at this array index will be set</td></tr></tbody></table>

```lua
for _, player in ipairs(entity.get_players(true)) do
  -- example 1
  player.m_bSpotted = true
  
  -- example 2 [array netprops]
  player.m_flPoseParameter[12] = 0.5
  
  -- example 3
  player['m_nSkin'] = 2
end
```

## Common

### :is\_player

`ent:is_player():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is a player entity.

### :is\_weapon

`ent:is_weapon():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is a weapon entity.

### :is\_dormant

`ent:is_dormant():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is dormant.

### :is\_bot

`ent:is_bot():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is a bot.

### :is\_alive

`ent:is_alive():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is alive.

### :is\_enemy

`ent:is_enemy():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is an enemy.

### :is\_visible

`ent:is_visible():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the entity is visible.

### :is\_occluded

`ent:is_occluded([ to_entity: entity ]):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>to_entity</strong></td><td><strong><code>entity</code></strong></td><td>Optional. The entity that will be checked for occlusion</td></tr></tbody></table>

If the `to_entity` is nil, the local player is checked. Returns <mark style="color:green;">`true`</mark> if the entity is completely occluded for the current entity.

### :get\_index

`ent:get_index():` <mark style="color:purple;">`number`</mark>

Returns the index of the entity.

### :get\_name

`ent:get_name():` <mark style="color:purple;">`string`</mark>

Returns the player name, weapon name or class name if the entity is neither of those.

### :get\_origin

`ent:get_origin():` <mark style="color:purple;">`vector`</mark>

Returns the position vector of the entity.

### :get\_angles

`ent:get_angles():` <mark style="color:purple;">`vector`</mark>

Returns the absolute angles of the entity.

### :get\_simulation\_time

`ent:get_simulation_time():` <mark style="color:purple;">`table`</mark>

Returns a table containing <mark style="color:blue;">`current`</mark> and <mark style="color:blue;">`old`</mark> simulation time values.

### :get\_classname

`ent:get_classname():` <mark style="color:purple;">`string`</mark>

Returns the name of the entity's class.

### :get\_classid

`ent:get_classid():` <mark style="color:purple;">`number`</mark>

Returns the ID of the entity's class.

### :get\_materials

`ent:get_materials():` <mark style="color:purple;">`table`</mark>

Returns a table containing all materials used by the entity.

### :get\_model\_name

`ent:get_model_name():` <mark style="color:purple;">`string`</mark>

Returns the model name of the entity.

## Players

### :get\_network\_state

`ent:get_network_state():` <mark style="color:purple;">`number`</mark>

Returns the network state of the player.

<table><thead><tr><th width="150">ID</th><th width="595.8382139978988">Description</th></tr></thead><tbody><tr><td><strong>0</strong></td><td>The entity is <mark style="color:green;"><code>not dormant</code></mark></td></tr><tr><td><strong>1</strong></td><td>The entity is dormant but the cheat has 100% info where the player is</td></tr><tr><td><strong>2</strong></td><td>The entity is dormant (updated by <mark style="color:blue;"><code>Shared ESP</code></mark>)</td></tr><tr><td><strong>3</strong></td><td>The entity is dormant (updated by <mark style="color:blue;"><code>Sounds</code></mark>)</td></tr><tr><td><strong>4</strong></td><td>The entity is dormant (not updated)</td></tr><tr><td><strong>5</strong></td><td>The entity is dormant (data is <mark style="color:red;"><code>unavailable</code></mark> or <mark style="color:red;"><code>too old</code></mark>)</td></tr></tbody></table>

### :get\_bbox

`ent:get_bbox():` <mark style="color:purple;">`table`</mark>

Returns a table containing <mark style="color:blue;">`pos1`</mark>, <mark style="color:blue;">`pos2`</mark>, and <mark style="color:blue;">`alpha`</mark> values.

### :get\_player\_info

`ent:get_player_info():` <mark style="color:purple;">`table`</mark>

Returns a table containing information from the `player_info_t` structure of the entity.

Table values: <mark style="color:blue;">`is_hltv`</mark>, <mark style="color:blue;">`is_fake_player`</mark>, <mark style="color:blue;">`steamid`</mark>, <mark style="color:blue;">`steamid64`</mark>, <mark style="color:blue;">`userid`</mark>, and <mark style="color:blue;">`files_downloaded`</mark>

### :get\_player\_weapon

`ent:get_player_weapon([all_weapons: boolean]):` <mark style="color:purple;">`entity / table`</mark>

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>all_weapons</strong></td><td><strong><code>boolean</code></strong></td><td>If <mark style="color:purple;"><code>true</code></mark> then all weapons will be included</td></tr></tbody></table>

Returns a pointer to the player's weapon entity.

If `all_weapons` is <mark style="color:green;">`true`</mark>, returns a table containing pointers to every weapon entity the player is currently carrying.

### :get\_anim\_state

`ent:get_anim_state():` <mark style="color:purple;">`table`</mark>

Returns a table containing information about the animation state of the player.

<details>

<summary>🧷 Animation state keys</summary>

* \[number] abs\_yaw
* \[number] abs\_yaw\_last
* \[vector] acceleration
* \[number] acceleration\_weight
* \[number] action\_weight\_bias\_remainder
* \[boolean] adjust\_started
* \[number] aim\_matrix\_transition
* \[number] aim\_matrix\_transition\_delay
* \[number] aim\_pitch\_max
* \[number] aim\_pitch\_min
* \[number] aim\_yaw\_max
* \[number] aim\_yaw\_min
* \[number] anim\_duck\_amount
* \[number] animstate\_model\_version
* \[number] cached\_model\_index
* \[number] camera\_smooth\_height
* \[userdata] crouch\_walk\_aim
* \[boolean] defuse\_started
* \[number] duck\_additional
* \[number] duration\_in\_air
* \[number] duration\_move\_weight\_is\_too\_high
* \[number] duration\_moving
* \[number] duration\_still
* \[number] duration\_strafing
* \[number] eye\_pitch
* \[number] eye\_position\_smooth\_lerp
* \[number] eye\_yaw
* \[boolean] feet\_crossed
* \[boolean] first\_foot\_plant\_since\_init
* \[boolean] first\_run\_since\_init
* \[boolean] flashed
* \[userdata] foot\_left
* \[number] foot\_lerp
* \[userdata] foot\_right
* \[number] in\_air\_smooth\_value
* \[number] jump\_to\_fall
* \[number] ladder\_speed
* \[number] ladder\_weight
* \[number] land\_anim\_multiplier
* \[boolean] landed\_on\_ground\_this\_frame
* \[boolean] landing
* \[number] last\_foot\_plant\_update
* \[number] last\_rendered\_eye\_z
* \[number] last\_time\_velocity\_over\_ten
* \[number] last\_update\_frame
* \[number] last\_update\_increment
* \[number] last\_update\_time
* \[number] last\_velocity\_test\_time
* \[userdata] layer\_order\_preset
* \[number] left\_ground\_height
* \[boolean] left\_the\_ground\_this\_frame
* \[number] move\_weight
* \[number] move\_weight\_smoothed
* \[number] move\_yaw
* \[number] move\_yaw\_current\_to\_ideal
* \[number] move\_yaw\_ideal
* \[number] next\_twitch\_time
* \[boolean] on\_ground
* \[boolean] on\_ladder
* \[boolean] plant\_anim\_started
* \[entity] player
* \[boolean] player\_is\_accelerating
* \[userdata] pose\_param\_mappings
* \[vector] position\_current
* \[vector] position\_last
* \[number] previous\_move\_state
* \[number] primary\_cycle
* \[number] recrouch\_weight
* \[boolean] smooth\_height\_valid
* \[number] speed\_as\_portion\_of\_crouch\_top\_speed
* \[number] speed\_as\_portion\_of\_run\_top\_speed
* \[number] speed\_as\_portion\_of\_walk\_top\_speed
* \[userdata] stand\_run\_aim
* \[userdata] stand\_walk\_aim
* \[number] static\_approach\_speed
* \[number] step\_height\_left
* \[number] step\_height\_right
* \[number] strafe\_change\_cycle
* \[number] strafe\_change\_target\_weight
* \[number] strafe\_change\_weight
* \[number] strafe\_change\_weight\_smooth\_fall\_off
* \[boolean] strafe\_changing
* \[number] strafe\_sequence
* \[number] stutter\_step
* \[vector] target\_acceleration
* \[number] time\_of\_last\_known\_injury
* \[number] time\_to\_align\_lower\_body
* \[boolean] twitch\_anim\_started
* \[vector] velocity
* \[vector] velocity\_last
* \[number] velocity\_length\_xy
* \[number] velocity\_length\_z
* \[vector] velocity\_normalized
* \[vector] velocity\_normalized\_non\_zero
* \[number] walk\_run\_transition
* \[boolean] walk\_to\_run\_transition\_state
* \[entity] weapon
* \[entity] weapon\_last
* \[entity] weapon\_last\_bone\_setup

</details>

### :get\_anim\_overlay

`ent:get_anim_overlay([idx: number]):` <mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>idx</strong></td><td><strong><code>number</code></strong></td><td>Index of the animation layer</td></tr></tbody></table>

Returns a table containing information about the specified animation layer. Pass `nil` to get every animation layer.

<details>

<summary>🧷 Animation overlay keys</summary>

* \[number] activity
* \[number] cycle
* \[number] dispatched\_dst
* \[number] dispatched\_src
* \[userdata] dispatched\_studio\_hdr
* \[number] invalidate\_physics\_bits
* \[number] layer\_animtime
* \[number] layer\_fade\_outtime
* \[number] order
* \[entity] owner
* \[number] playback\_rate
* \[number] prev\_cycle
* \[number] sequence
* \[number] weight
* \[number] weight\_delta\_rate

</details>

### :get\_eye\_position

`ent:get_eye_position():` <mark style="color:purple;">`vector`</mark>

Returns the eye position of the player.

### :get\_bone\_position

`ent:get_bone_position(idx: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>idx</strong></td><td><strong><code>number</code></strong></td><td>Index of the bone</td></tr></tbody></table>

Returns the position of the specified bone.

### :get\_hitbox\_position

`ent:get_hitbox_position(idx: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>idx</strong></td><td><strong><code>number</code></strong></td><td>Index of the hitbox</td></tr></tbody></table>

Returns the position of the specified hitbox.

### :get\_steam\_avatar

`ent:get_steam_avatar():` <mark style="color:purple;">`ImgObject`</mark>

Returns a pointer to the Steam avatar image object of the specified entity.

### :get\_xuid

`ent:get_xuid():` <mark style="color:purple;">`string`</mark>

Returns the Steam ID of the player.

### :get\_resource

`ent:get_resource():` <mark style="color:purple;">`entity`</mark>

Returns the pointer to the CCSPlayerResource instance attached to the player, or nil if none exists.

### :get\_spectators

`ent:get_spectators():` <mark style="color:purple;">`table`</mark>

Returns a table of pointers to the players that are currently spectating the specified player.

### :set\_icon

`ent:set_icon([icon: string])`

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>icon</strong></td><td><strong><code>string</code></strong></td><td>Optional. URL to the icon or a panorama path.</td></tr></tbody></table>

Sets an icon in the scoreboard next to the specified player's avatar. The icon will be removed if no icon was provided.

### :simulate\_movement

`ent:simulate_movement([origin: vector, velocity: vector, flags: number]):` <mark style="color:purple;">`sim_ctx`</mark>

<table><thead><tr><th width="171.291500478032">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>origin</strong></td><td><strong><code>vector</code></strong></td><td>Specifies the origin from which the movement should be simulated. If not provided, it uses the player's current origin.</td></tr><tr><td><strong>velocity</strong></td><td><strong><code>vector</code></strong></td><td>Specifies the velocity vector for the simulated movement. If not provided, the function will use the player's current velocity as the default for the simulation.</td></tr><tr><td><strong>flags</strong></td><td><strong><code>number</code></strong></td><td>Specifies the m_fFlags 32-bit mask for prediction. If not provided, it uses the player's current <code>m_fFlags</code> value.</td></tr></tbody></table>

This function allows you to simulate players' movement by optionally providing an origin, velocity, and flags. Returns an instance of the <mark style="color:purple;">`sim_ctx`</mark> class containing details and tools for the movement simulation.

## Simulation Context

{% hint style="info" %}
This class encapsulates the context and results of a movement simulation initiated by `:simmulate_movement`.
{% endhint %}

### :think

`sim:think([ticks: number])`

Simulates the player's movement for a specified number of ticks. If not specified, it defaults to simulating for 1 tick.

<table><thead><tr><th width="214.12668192920174">Name</th><th width="120">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>origin</strong></td><td><strong><code>vector</code></strong></td><td>Position of the player after simulation.</td></tr><tr><td><strong>velocity</strong></td><td><strong><code>vector</code></strong></td><td>Velocity of the player after simulation.</td></tr><tr><td><strong>view_offset</strong></td><td><strong><code>number</code></strong></td><td>Z axis view offset. Used to calculate the eye position.</td></tr><tr><td><strong>duck_amount</strong></td><td><strong><code>number</code></strong></td><td><code>m_flDuckAmount</code> value of the player after simulation.</td></tr><tr><td><strong>did_hit_collision</strong></td><td><strong><code>boolean</code></strong></td><td>Flags whether the player hit a collision during the simulation.</td></tr><tr><td><strong>obb_mins</strong></td><td><strong><code>vector</code></strong></td><td>Player's bounding box's minimum points.</td></tr><tr><td><strong>obb_maxs</strong></td><td><strong><code>vector</code></strong></td><td>Player's bounding box's maximum points.</td></tr><tr><td><strong>move</strong></td><td><strong><code>vector</code></strong></td><td></td></tr><tr><td><strong>simulation_ticks</strong></td><td><strong><code>number</code></strong></td><td>The number of ticks over which the simulation was conducted.</td></tr><tr><td><strong>gravity_per_apply</strong></td><td><strong><code>number</code></strong></td><td>Indicates the applied gravitational force during the simulation.</td></tr><tr><td><strong>original_max_speed</strong></td><td><strong><code>number</code></strong></td><td>The player's maximum speed before the simulation.</td></tr><tr><td><strong>max_speed</strong></td><td><strong><code>number</code></strong></td><td>The maximum speed achieved by the player during the simulation.</td></tr><tr><td><strong>is_speed_cropped</strong></td><td><strong><code>boolean</code></strong></td><td></td></tr><tr><td><strong>velocity_modifier</strong></td><td><strong><code>number</code></strong></td><td><code>m_flVelocityModifier</code> value of the player after simulation.</td></tr><tr><td><strong>duck_speed</strong></td><td><strong><code>number</code></strong></td><td>The simulated speed at which the player can be crouching.</td></tr><tr><td><strong>stamina</strong></td><td><strong><code>number</code></strong></td><td><code>m_flStamina</code>value of the player after simulation.</td></tr><tr><td><strong>surface_friction</strong></td><td><strong><code>number</code></strong></td><td><code>m_surfaceFriction</code> value of the player after simulation.</td></tr><tr><td><strong>trace</strong></td><td><strong><code>trace</code></strong></td><td>Post-simulation trace object.</td></tr></tbody></table>

## Weapons

{% hint style="info" %}
Access functions listed below via [<mark style="color:purple;">`:get_player_weapon`</mark>](#get_player_weapon) function
{% endhint %}

### :get\_weapon\_index

`ent:get_weapon_index():` <mark style="color:purple;">`number`</mark>

Returns the index of the weapon.

### :get\_weapon\_icon

`ent:get_weapon_icon():` <mark style="color:purple;">`ImgObject`</mark>

Returns the icon of the weapon.

### :get\_weapon\_info

`ent:get_weapon_info():` <mark style="color:purple;">`userdata`</mark>

Returns a pointer to the <mark style="color:blue;">`CCSWeaponInfo`</mark> struct of the weapon.

<details>

<summary>🧷 Weapon Info keys</summary>

* \[number] max\_player\_speed
* \[number] max\_player\_speed\_alt
* \[number] attack\_move\_speed\_factor
* \[number] spread
* \[number] spread\_alt
* \[number] inaccuracy\_crouch
* \[number] inaccuracy\_crouch\_alt
* \[number] inaccuracy\_stand
* \[number] inaccuracy\_stand\_alt
* \[number] inaccuracy\_jump\_initial
* \[number] inaccuracy\_jump\_apex
* \[number] inaccuracy\_jump
* \[number] inaccuracy\_jump\_alt
* \[number] inaccuracy\_land
* \[number] inaccuracy\_land\_alt
* \[number] inaccuracy\_ladder
* \[number] inaccuracy\_ladder\_alt
* \[number] inaccuracy\_fire
* \[number] inaccuracy\_fire\_alt
* \[number] inaccuracy\_move
* \[number] inaccuracy\_move\_alt
* \[number] inaccuracy\_reload
* \[number] recoil\_seed
* \[number] recoil\_angle
* \[number] recoil\_angle\_alt
* \[number] recoil\_angle\_variance
* \[number] recoil\_angle\_variance\_alt
* \[number] recoil\_magnitude
* \[number] recoil\_magnitude\_alt
* \[number] recoil\_magnitude\_variance\_alt
* \[number] spread\_seed
* \[number] recovery\_time\_crouch
* \[number] recovery\_time\_stand
* \[number] recovery\_time\_crouch\_final
* \[number] recovery\_time\_stand\_final
* \[number] recovery\_transition\_start\_bullet
* \[number] recovery\_transition\_end\_bullet
* \[boolean] unzoom\_after\_shot
* \[boolean] hide\_view\_model\_zoomed
* \[number] zoom\_level
* \[userdata] zoom\_fov
* \[userdata] zoom\_time
* \[string] weapon\_class
* \[boolean] has\_burst\_mode
* \[boolean] is\_revolver
* \[number] recoil\_magnitude\_variance
* \[string] weapon\_name
* \[number] weapon\_type
* \[number] weapon\_price
* \[string] console\_name
* \[number] max\_clip1
* \[number] max\_clip2
* \[string] world\_model
* \[string] view\_model
* \[string] dropped\_model
* \[string] hud\_name
* \[number] kill\_award
* \[number] cycle\_time
* \[number] cycle\_time\_alt
* \[number] time\_to\_idle
* \[boolean] full\_auto
* \[number] damage
* \[number] headshot\_multiplier
* \[number] armor\_ratio
* \[number] bullets
* \[number] penetration
* \[number] range
* \[number] range\_modifier
* \[number] throw\_velocity
* \[boolean] has\_silencer

</details>

### :get\_weapon\_owner

`ent:get_weapon_owner():` <mark style="color:purple;">`entity`</mark>

Returns a pointer to the weapon owner's entity.

### :get\_weapon\_reload

`ent:get_weapon_reload():` <mark style="color:purple;">`number`</mark>

Returns the weapon reload percentage (0.0-1.0), -1 if not reloading.&#x20;

### :get\_max\_speed

`ent:get_max_speed():` <mark style="color:purple;">`number`</mark>

Returns the maximum speed the player can move with the weapon.

### :get\_spread

`ent:get_spread():` <mark style="color:purple;">`number`</mark>

Returns the spread of the weapon in radians.

### :get\_inaccuracy

`ent:get_inaccuracy():` <mark style="color:purple;">`number`</mark>

Returns the inaccuracy of the weapon in radians.


# esp

## Example available!

{% content-ref url="/pages/z7xi2JlDIiuW4Re07FT5" %}
[ESP](/useful-information/script-examples/esp)
{% endcontent-ref %}

## Class names

Available ESP classes: <mark style="color:blue;">`enemy`</mark>, <mark style="color:blue;">`team`</mark>, <mark style="color:blue;">`self`</mark>

## Functions:

### :new\_text

`esp.esp_class:new_text(name: string, preview: string, callback: function):` <mark style="color:purple;">`ESPGroup`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>ESP element picker text</td></tr><tr><td><strong>preview</strong></td><td><strong><code>string</code></strong></td><td>ESP preview text</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Function that will be called for each entity while drawing the ESP</td></tr></tbody></table>

Registers ESP text to the specified class. The callback function is called every frame. It is passed an entity pointer. Return a string in order to manage the output.

### :new\_bar

`esp.esp_class:new_bar(name: string, callback: function):` <mark style="color:purple;">`ESPGroup`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>ESP element picker text</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Function that will be called for each entity while drawing the ESP</td></tr></tbody></table>

Registers an ESP bar to the specified class. The callback function is called every frame. Access the entity pointer using the arguments of the specified callback. Return a boolean followed by the number in the range \[0.0, 1.0].

### :new\_item

`esp.esp_class:new_item(name: string):` <mark style="color:purple;">`ESPGroup`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>ESP element picker text</td></tr></tbody></table>

Registers an ESP item that is neither text nor a bar.

#### 🔗 struct <mark style="color:blue;">`ESPGroup`</mark>

<table><thead><tr><th width="160.7500302222433">Name</th><th width="150">Type</th><th width="420.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>get</strong></td><td><strong><code>function</code></strong></td><td>Returns the value of the item.</td></tr><tr><td><strong>set</strong></td><td><strong><code>function</code></strong></td><td>Sets the value of the item.</td></tr><tr><td><strong>name</strong></td><td><strong><code>function</code></strong></td><td>Returns the name of the item. If the argument is present, the name is set to the new value.</td></tr><tr><td><strong>create</strong></td><td><strong><code>function</code></strong></td><td>Attaches a <a href="/pages/vPTuoHPQFCBz9qmOdRTX#menugroup"><code>group</code></a> to the current item.</td></tr></tbody></table>


# events

## Functions:

{% hint style="info" %}
Available cheat events can be found [here](/documentation/events).
{% endhint %}

### :set

`events.event_name:set(callback: function)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Lua function to call</td></tr></tbody></table>

Sets the callback for the specified event. The registered function will be called every time the specified event occurs.

### :unset

`events.event_name:unset(callback: function)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Lua function that was passed to the <mark style="color:purple;"><code>:set</code></mark> function</td></tr></tbody></table>

Unsets the callback that was set via the <mark style="color:purple;">`:set`</mark> function from the specified event.

### :call

`events.event_name:call(...)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>...</strong></td><td></td><td>Arguments to be passed by the callback</td></tr></tbody></table>

Fires the specified event.

### Alternative behavior:

### :\_\_call

`events.event_name(callback: function[, state: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Lua function to call</td></tr><tr><td><strong>state</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. Callback state. If not specified then toggles the callback state for the specified function.</td></tr></tbody></table>

Sets / unsets the callback for the specified event.

{% tabs %}
{% tab title="Toggle Behavior" %}
{% code overflow="wrap" lineNumbers="true" %}

```lua
local function function_callback()
    print(globals.tickcount)
end

-- Sets the createmove callback for the specified function
events.createmove(function_callback)

-- Execute after 0.5 secs
utils.execute_after(0.5, function()
    -- Toggles the createmove callback for the specified function
    events.createmove(function_callback)
end)
```

{% endcode %}
{% endtab %}

{% tab title="State Behavior" %}
{% code overflow="wrap" lineNumbers="true" %}

```lua
local function function_callback()
    print(globals.tickcount)
end

events.createmove(function_callback, true) -- Sets the callback
events.createmove(function_callback, false) -- Unsets the callback
```

{% endcode %}
{% endtab %}
{% endtabs %}


# files

## Example available!

{% content-ref url="/pages/H5xK7zW7ItbXSGBNCSGj" %}
[Broken mention](broken://pages/H5xK7zW7ItbXSGBNCSGj)
{% endcontent-ref %}

## Functions:

### create\_folder

`files.create_folder(path: string)`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>New folder path</td></tr></tbody></table>

### read

`files.read(path: string):` <mark style="color:purple;">`any`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>Path to the file</td></tr></tbody></table>

Returns contents of the specified file.

### write

`files.write(path: string, contents: string[, is_binary: boolean]):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>Path to the file</td></tr><tr><td><strong>contents</strong></td><td><strong><code>any</code></strong></td><td>Contents the file should be set to</td></tr><tr><td><strong>is_binary</strong></td><td><strong><code>boolean</code></strong></td><td>Is <mark style="color:purple;"><code>contents</code></mark> a binary</td></tr></tbody></table>

Replaces contents of the specified file. Returns <mark style="color:purple;">`false`</mark> on failure.

### get\_crc32

`files.get_crc32(path: string):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>Path to the file</td></tr></tbody></table>

Returns the crc32 checksum of the file.


# globals

## Variables:

### curtime

`globals.curtime` `:` <mark style="color:purple;">`number`</mark>

Server time in seconds.

### realtime

`globals.realtime` `:` <mark style="color:purple;">`number`</mark>

Local time in seconds.

### frametime

`globals.frametime` `:` <mark style="color:purple;">`number`</mark>

Duration of the last game frame in seconds.

### framecount

`globals.framecount` `:` <mark style="color:purple;">`number`</mark>

Amount of frames since the game started.

### absoluteframetime

`globals.absoluteframetime` `:` <mark style="color:purple;">`number`</mark>

Duration of the last game frame in seconds.

### tickcount

`globals.tickcount` `:` <mark style="color:purple;">`number`</mark>

Number of ticks elapsed on the server.

### tickinterval

`globals.tickinterval` `:` <mark style="color:purple;">`number`</mark>

Duration of a tick in seconds.

### max\_players

`globals.max_players` `:` <mark style="color:purple;">`number`</mark>

Maximum number of players on the server.

### is\_connected

`globals.is_connected` `:` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the player is connected, but not necessarily active in game (could still be loading).

### is\_in\_game

`globals.is_in_game` `:` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the player is currently connected to a game server.

### choked\_commands

`globals.choked_commands` `:` <mark style="color:purple;">`number`</mark>

Number of choked commands.

### commandack

`globals.commandack` `:` <mark style="color:purple;">`number`</mark>

Current command number acknowledged by server.

### commandack\_prev

`globals.commandack_prev` `:` <mark style="color:purple;">`number`</mark>

Sequence number of last outgoing command.

### last\_outgoing\_command

`globals.last_outgoing_command` `:` <mark style="color:purple;">`number`</mark>

Number of last command sequence number acknowledged by server.

### server\_tick

`globals.server_tick` `:` <mark style="color:purple;">`number`</mark>

Last-received tick from the server.

### client\_tick

`globals.client_tick` `:` <mark style="color:purple;">`number`</mark>

The client's own tick count.

### delta\_tick

`globals.delta_tick` `:` <mark style="color:purple;">`number`</mark>

Last-valid received snapshot (server) tick.

### clock\_offset

`globals.clock_offset` `:` <mark style="color:purple;">`number`</mark>

Difference between the server and client tick counts, used to predict the current server tick count.


# json

## Functions:

### parse

`json.parse(json_text: string):` <mark style="color:purple;">`any`</mark>

| Argument       | Type         | Description     |
| -------------- | ------------ | --------------- |
| **json\_text** | **`string`** | UTF-8 JSON text |

Will deserialize any UTF-8 JSON string into a Lua value or table.

### stringify

`json.stringify(value: any):` <mark style="color:purple;">`string`</mark>

| Argument  | Type      | Description                                 |
| --------- | --------- | ------------------------------------------- |
| **value** | **`any`** | A lua boolean, number, string, table or nil |

Will serialize a Lua value into a string containing the JSON representation.


# materials

## Example available!

{% content-ref url="/pages/03NGFcMa3nAJ77FO26kS" %}
[Materials](/useful-information/script-examples/materials)
{% endcontent-ref %}

## Functions:

### get

`materials.get(path: string[, force_load: boolean]):` <mark style="color:purple;">`Material`</mark>

<table><thead><tr><th width="156.2187096468122">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>Directory to the specified material</td></tr><tr><td><strong>force_load</strong></td><td><strong><code>force_load</code></strong></td><td>Loads the material if not loaded</td></tr></tbody></table>

Returns the material object in the specified path.

### get\_materials

`materials.get_materials(partial_path: string[, force_load: boolean, callback: function]):` <mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="159.2187096468122">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>partial_path</strong></td><td><strong><code>string</code></strong></td><td>Directory to the specified materials</td></tr><tr><td><strong>force_load</strong></td><td><strong><code>force_load</code></strong></td><td>Loads each material if not loaded</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>A callback with a pointer to the material object as the argument</td></tr></tbody></table>

If the callback is nil, it returns the table of material objects along the specified path. Otherwise the callback will be called. Access the material object using the arguments of the specified callback.

### create

`materials.create(name: strings, key_values: string):` <mark style="color:purple;">`Material`</mark>

<table><thead><tr><th width="163.2187096468122">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>New material name</td></tr><tr><td><strong>key_values</strong></td><td><strong><code>string</code></strong></td><td>New material values</td></tr></tbody></table>

Creates and returns a new material object

## 🔗 struct <mark style="color:purple;">`Material`</mark>

### :get\_name

`material:get_name():` <mark style="color:purple;">`string`</mark>

Returns the name of the material.

### :get\_texture\_group\_name()

`material:get_texture_group_name():` <mark style="color:purple;">`string`</mark>

Returns the texture group name of the material.

### :var\_flag

`material:var_flag(flag: number[, value: boolean]):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>flag</strong></td><td><strong><code>number</code></strong></td><td>Material var flag</td></tr><tr><td><strong>value</strong></td><td><strong><code>boolean</code></strong></td><td>New material var flag value</td></tr></tbody></table>

Gets or sets the value of the material var flag.

### :shader\_param

`material:shader_param(name: string[, value: any]):` <mark style="color:purple;">`any`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Shader parameter name</td></tr><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>New shader parameter value</td></tr></tbody></table>

Gets or sets the value of the material shader parameter.

### :color\_modulate

`material:color_modulate([color: color])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>New color modulation value</td></tr></tbody></table>

Gets or sets the material color modulation value.

### :alpha\_modulate

`material:alpha_modulate([alpha: number])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>alpha</strong></td><td><strong><code>number</code></strong></td><td>New alpha modulation value</td></tr></tbody></table>

Gets or sets the material alpha modulation value.

### :is\_valid

`material:is_valid():` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if the material is valid.

### :reset

`material:reset()`

Resets the material properties to its original values along with discarding the override.

### :override

`material:override(mat: Material)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>mat</strong></td><td><strong><code>Material</code></strong></td><td>Material object with the needed properties</td></tr></tbody></table>

Overrides material properties to properties from another material without setting them.


# math

## Functions:

### abs

`math.abs(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the absolute value of x.

### acos

`math.acos(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the arc cosine of x (in radians).

### asin

`math.asin(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the arc sine of x (in radians).

### atan

`math.atan(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the arc tangent of x (in radians).

### atan2

`math.atan2(x: number, y: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>y</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the arc tangent of y/x (in radians), but uses the signs of both parameters to find the quadrant of the result. (It also handles correctly the case of x being zero.)

### ceil

`math.ceil(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the smallest integer larger than or equal to x.

### clamp

`math.clamp(value: number[, min: number, max: number]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>The value to clamp</td></tr><tr><td><strong>min</strong></td><td><strong><code>number</code></strong></td><td>The minimum value</td></tr><tr><td><strong>max</strong></td><td><strong><code>number</code></strong></td><td>The maximum value</td></tr></tbody></table>

Returns the clamped value.

### cos

`math.cos(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the cosine of x (assumed to be in radians).

### cosh

`math.cosh(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the hyperbolic cosine of x.

### deg

`math.deg(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the angle x (given in radians) in degrees.

### exp

`math.exp(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the value e power x.

### floor

`math.floor(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the largest integer smaller than or equal to x.

### fmod

`math.fmod(x: number, y: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>y</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the remainder of the division of x by y that rounds the quotient towards zero.

### frexp

`math.frexp(x: number):` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

$$
x = m2^e
$$

Returns `m` and `e` such that `x = m2e`, `e` is an integer and the absolute value of `m` is in the range `[0.5, 1)` (or zero when `x` is zero).

### huge

`math.huge` `:` <mark style="color:purple;">`number`</mark>

The value HUGE\_VAL, a value larger than or equal to any other numerical value.

### **ldexp**

`math.ldexp(x: number, e: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>e</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

$$
output = m2^e
$$

Returns `m2e` (e should be an integer).

### log

`math.log(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the natural logarithm of x.

### log10

`math.log10(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the base-10 logarithm of x.

### map

`math.map(value: number, in_from: number, in_to: number, out_from: number, out_to: number[, should_clamp: boolean]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>The value to map</td></tr><tr><td><strong>in_from</strong></td><td><strong><code>number</code></strong></td><td>In minimum value</td></tr><tr><td><strong>in_to</strong></td><td><strong><code>number</code></strong></td><td>In maximum value</td></tr><tr><td><strong>out_from</strong></td><td><strong><code>number</code></strong></td><td>Out minimum value</td></tr><tr><td><strong>out_to</strong></td><td><strong><code>number</code></strong></td><td>Out maximum value</td></tr><tr><td><strong>should_clamp</strong></td><td><strong><code>boolean</code></strong></td><td>Clamp <code>In</code> range</td></tr></tbody></table>

Linearly maps two number ranges and returns the mapped value.

### max

`math.max(x: number[, ...]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated numbers to concatenate with <code>x</code></td></tr></tbody></table>

Returns the maximum value among its arguments.

### min

`math.min(x: number[, ...]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated numbers to concatenate with <code>x</code></td></tr></tbody></table>

Returns the minimum value among its arguments.

### modf

`math.modf(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns two numbers, the integral part of x and the fractional part of x.

### normalize\_yaw

`math.normalize_yaw(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the normalized yaw angle value.

### pi

`math.pi` `:` <mark style="color:purple;">`number`</mark>

The value of pi.

### pow

`math.pow(x: number, y: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>y</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns x^y. (You can also use the expression x^y to compute this value.)

### rad

`math.rad(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the angle x (given in degrees) in radians.

### random

`math.random([m [, n]]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>m</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr><tr><td><strong>n</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

This function is an interface to the simple pseudo-random generator function rand provided by ANSI C.When called without arguments, returns a uniform pseudo-random real number in the range \[0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range \[1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range \[m, n].

### randomseed

`math.randomseed(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Sets x as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers.

### sin

`math.sin(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the sine of x (assumed to be in radians).

### sinh

`math.sinh(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the hyperbolic sine of x.

### sqrt

`math.sqrt(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the square root of x. (You can also use the expression x^0.5 to compute this value.)

### tan

`math.tan(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the tangent of x (assumed to be in radians).

### tanh

`math.tanh(x: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="170.08022516342308">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>Number</td></tr></tbody></table>

Returns the hyperbolic tangent of x.


# ui

## Example available!

{% content-ref url="/pages/ngLNzKOcgz2hb1UIyqdj" %}
[UI](/useful-information/script-examples/ui)
{% endcontent-ref %}

## Functions:

### get\_alpha

`ui.get_alpha():` <mark style="color:purple;">`number`</mark>

Returns the menu opacity as a unit interval (value in the range \[0, 1]).

### get\_size

`ui.get_size():` <mark style="color:purple;">`vector`</mark>

Returns the current menu size.

### get\_position

`ui.get_position():` <mark style="color:purple;">`vector`</mark>

Returns the current menu position.

### get\_mouse\_position

`ui.get_mouse_position():` <mark style="color:purple;">`vector`</mark>

Returns the current mouse position.

### get\_binds

`ui.get_binds():` <mark style="color:purple;">`table`</mark>

Returns a table of pointers to hotkeys.

#### struct <mark style="color:purple;">`Hotkey`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Hotkey name</td></tr><tr><td><strong>mode</strong></td><td><strong><code>number</code></strong></td><td>Hotkey mode (<mark style="color:purple;"><code>1</code></mark>: Hold, <mark style="color:purple;"><code>2</code></mark>: Toggle)</td></tr><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>Hotkey value</td></tr><tr><td><strong>active</strong></td><td><strong><code>boolean</code></strong></td><td>Hotkey state</td></tr><tr><td><strong>reference</strong></td><td><strong><code>MenuItem</code></strong></td><td>Pointer to the menu item</td></tr></tbody></table>

### get\_style

`ui.get_style([ name: string ]):` <mark style="color:purple;">`color`</mark> / <mark style="color:purple;">`table`</mark>

Returns the color of the Style Option. Pass `nil` to return a table with the style options.

### get\_icon

`ui.get_icon(name: string):` <mark style="color:purple;">`string`</mark>

Returns the unicode converted string corresponding the fontawesome icon.

### create

{% tabs %}
{% tab title="Group" %}
`ui.create(group: string):` <mark style="color:purple;">`MenuGroup`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Group name</td></tr></tbody></table>

\
Creates and returns a menu group object.

<div align="left"><img src="/files/p0IEJZeufWadJNYja1iX" alt=""></div>
{% endtab %}

{% tab title="Tab" %}
`ui.create(tab: string, group: string[, column: number]):` <mark style="color:purple;">`MenuGroup`</mark>

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Group name</td></tr><tr><td><strong>column</strong></td><td><strong><code>number</code></strong></td><td>Optional. Column ID (<mark style="color:purple;"><code>1</code></mark>: Left <mark style="color:purple;"><code>2</code></mark>: Right or <code>nil</code> for automatic alignment.)</td></tr></tbody></table>

\
Creates and returns a menu group object.

<div align="left"><img src="/files/f3c5FgRL5DVrBKanQepB" alt=""></div>
{% endtab %}
{% endtabs %}

### find

{% tabs %}
{% tab title="Item example" %}
`ui.find(category: string, tab: string, group: string, item: string):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td>Category name, e.g. "Aimbot" or "Visuals".</td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name that belongs to the category.</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Name of group with the item.</td></tr><tr><td><strong>item</strong></td><td><strong><code>string</code></strong></td><td>The needed item.</td></tr></tbody></table>

Returns the <mark style="color:purple;">`MenuItem`</mark> object that corresponds to the specified path.

`ui.find(category: string, tab: string, sub_tab: string, group: string, item: string):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td>Category name, e.g. "Aimbot" or "Visuals".</td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name that belongs to the category.</td></tr><tr><td><strong>sub_tab</strong></td><td><strong><code>string</code></strong></td><td>Sub-tab name.</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Name of group with the item.</td></tr><tr><td><strong>item</strong></td><td><strong><code>string</code></strong></td><td>The needed item.</td></tr></tbody></table>

Returns the <mark style="color:purple;">`MenuItem`</mark> object that corresponds to the specified path.
{% endtab %}

{% tab title="Sub-item example" %}
`ui.find(category: string, tab: string, group: string, item: string, sub_item):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td>Category name, e.g. "Aimbot" or "Visuals".</td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name that belongs to the category.</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Name of group with the item.</td></tr><tr><td><strong>item</strong></td><td><strong><code>string</code></strong></td><td>The item with a group (gear) attached.</td></tr><tr><td><strong>sub_item</strong></td><td><strong><code>string</code></strong></td><td>The sub-item in the item group.</td></tr></tbody></table>

Returns the <mark style="color:purple;">`MenuItem`</mark> object that corresponds to the specified path.

`ui.find(category: string, tab: string, sub_tab: string, group: string, item: string, sub_item):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td>Category name, e.g. "Aimbot" or "Visuals".</td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name that belongs to the category.</td></tr><tr><td><strong>sub_tab</strong></td><td><strong><code>string</code></strong></td><td>Sub-tab name.</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Name of group with the item.</td></tr><tr><td><strong>item</strong></td><td><strong><code>string</code></strong></td><td>The item with a group (gear) attached.</td></tr><tr><td><strong>sub_item</strong></td><td><strong><code>string</code></strong></td><td>The sub-item in the item group.</td></tr></tbody></table>

Returns the <mark style="color:purple;">`MenuItem`</mark> object that corresponds to the specified path.
{% endtab %}

{% tab title="Group example" %}
`ui.find(category: string, tab: string, group: string):` <mark style="color:purple;">`MenuGroup`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td>Category name, e.g. "Aimbot" or "Visuals".</td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name that belongs to the category.</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Name of the needed group.</td></tr></tbody></table>

Returns the <mark style="color:purple;">`MenuGroup`</mark> object that corresponds to the specified path.

`ui.find(category: string, tab: string, sub_tab_name: string, group: string):` <mark style="color:purple;">`MenuGroup`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td>Category name, e.g. "Aimbot" or "Visuals".</td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td>Tab name that belongs to the category.</td></tr><tr><td><strong>sub_tab</strong></td><td><strong><code>string</code></strong></td><td>Sub-tab name.</td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td>Name of the needed group.</td></tr></tbody></table>
{% endtab %}

{% tab title="Global item example " %}
`ui.find(group_name: string, item_name: string):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="199">Name</th><th width="163">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>group_name</strong></td><td><strong><code>string</code></strong></td><td>Global group name, e.g. "Settings".</td></tr><tr><td><strong>item_name</strong></td><td><strong><code>string</code></strong></td><td>Item name, e.g. "Dpi Scale".</td></tr></tbody></table>

Returns the <mark style="color:purple;">`MenuItem`</mark> object that corresponds to the specified path.
{% endtab %}

{% tab title="ESP Item Example" %}
`ui.find(category: string, tab: string, sub_tab: string, group: string, item_category: string, item: string):` <mark style="color:purple;">`ESPGroup`</mark>

<table><thead><tr><th width="199">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>category</strong></td><td><strong><code>string</code></strong></td><td></td></tr><tr><td><strong>tab</strong></td><td><strong><code>string</code></strong></td><td></td></tr><tr><td><strong>sub_tab</strong></td><td><strong><code>string</code></strong></td><td></td></tr><tr><td><strong>group</strong></td><td><strong><code>string</code></strong></td><td></td></tr><tr><td><strong>item_category</strong></td><td><strong><code>string</code></strong></td><td></td></tr><tr><td><strong>item</strong></td><td><strong><code>string</code></strong></td><td></td></tr></tbody></table>

Returns the <mark style="color:purple;">`ESPGroup`</mark> object that corresponds to the specified path.
{% endtab %}
{% endtabs %}

This can return multiple items or `nil` on failure.

### sidebar

{% embed url="<https://fontawesome.com/v6/search>" %}

`ui.sidebar([name: string, icon_name: string]):` <mark style="color:purple;">`string`</mark>, <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Optional. Sidebar tab name</td></tr><tr><td><strong>icon_name</strong></td><td><strong><code>string</code></strong></td><td>Optional. Icon name (Brand icons are currently not supported)</td></tr></tbody></table>

Gets or sets the sidebar tab name and an icon.

### localize

`ui.localize(lang: string, str: string[, localized: string]):` <mark style="color:purple;">`string`</mark> / <mark style="color:purple;">`nil`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>lang</strong></td><td><strong><code>string</code></strong></td><td>Language code.</td></tr><tr><td><strong>str</strong></td><td><strong><code>string</code></strong></td><td>String to localize or to get the localized string from.</td></tr><tr><td><strong>localized</strong></td><td><strong><code>string</code></strong></td><td>Optional. The localized variant.</td></tr></tbody></table>

Returns the localized string for the specified language code. If `localized` is present, the `str` will be localized accordingly.

## 🔗 <mark style="color:blue;">`MenuGroup`</mark>

### :switch

`group:switch(name: string[, init: boolean]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="165.2187096468122">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>init</strong></td><td><strong><code>boolean</code></strong></td><td>Default value</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :slider

`group:slider(name: string, min: number, max: number[, init: number, scale: number, tooltip: function]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="166.60675064558396">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>min</strong></td><td><strong><code>number</code></strong></td><td>Minimum allowed value</td></tr><tr><td><strong>max</strong></td><td><strong><code>number</code></strong></td><td>Maximum allowed value</td></tr><tr><td><strong>init</strong></td><td><strong><code>number</code></strong></td><td>Default value</td></tr><tr><td><strong>scale</strong></td><td><strong><code>number</code></strong></td><td>Display value multiplier. Can be used for decimal places.</td></tr><tr><td><strong>tooltip</strong></td><td><strong><code>string / function</code></strong></td><td>A string appends itself to the display value. A function allows you to access the raw display value and displays anything it returns.</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :combo

`group:combo(name: string, items: any[, ...]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>items</strong></td><td><strong><code>any</code></strong></td><td>One or more comma separated values that will be added to the combo. Alternatively, a table of strings that will be added</td></tr><tr><td><strong>...</strong></td><td></td><td></td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :selectable

`group:selectable(name: string, items: any[, ...]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>items</strong></td><td><strong><code>any</code></strong></td><td>One or more comma separated values that will be added to the combo. Alternatively, a table of strings that will be added</td></tr><tr><td><strong>...</strong></td><td></td><td></td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :color\_picker <a href="#render.line" id="render.line"></a>

{% tabs %}
{% tab title="Simple" %}
`group:color_picker(name: string[, color: color]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Optional. Initial color value</td></tr></tbody></table>
{% endtab %}

{% tab title="Multi-Color " %}
`group:color_picker(name: string, colors: table):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>colors</strong></td><td><strong><code>table</code></strong></td><td>Table containing tables with a string index, and those tables should contain one or multiple color objects. Check UI examples.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Creates and returns a menu item object, or throws an error on failure.

### :button

`group:button(name: string[, callback: function, alt_style: boolean]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Optional. Function that will be called when the button is clicked</td></tr><tr><td><strong>alt_style</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. Pass <mark style="color:purple;"><code>true</code></mark> to enable the alternative style for the specified button</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :hotkey

{% embed url="<https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes>" %}

`group:hotkey(name: string[, default_key: number):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>default_key</strong></td><td><strong><code>number</code></strong></td><td>Optional. Default key</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :input

`group:input(name: string[, text: string]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Optional. Default value</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :list

`group:list(name: string, items: any[, ...]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>items</strong></td><td><strong><code>any</code></strong></td><td>One or more comma separated values that will be added to the combo. Alternatively, a table of strings that will be added</td></tr><tr><td><strong>...</strong></td><td></td><td></td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :listable&#x20;

`group:listable(name: string, items: any[, ...]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Item name</td></tr><tr><td><strong>items</strong></td><td><strong><code>any</code></strong></td><td>One or more comma separated values that will be added to the combo. Alternatively, a table of strings that will be added</td></tr><tr><td><strong>...</strong></td><td></td><td></td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :label

`group:label(text: string):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Label text</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

### :texture

📌 Create the texture via the [`:load_image`](https://docs-csgo.neverlose.cc/documentation/variables/pages/nxusgjs91kVUpigQuS6d#render.line-7) function.

`group:texture(texture: ImgObject[, size: vector, color: color, mode: string, rounding: number]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>texture</strong></td><td><strong><code>ImgObject</code></strong></td><td>Image object</td></tr><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>Optional. Size of the image</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Optional. Color of the texture</td></tr><tr><td><strong>mode</strong></td><td><strong><code>string</code></strong></td><td>Optional. <mark style="color:purple;"><code>f</code></mark> for fill, <mark style="color:purple;"><code>r</code></mark> for repeat</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>Optional. Image border rounding</td></tr></tbody></table>

Creates and returns a menu item object, or throws an error on failure.

## 🔗 <mark style="color:blue;">`MenuItem`</mark>

### :get

`item:get():` <mark style="color:purple;">`any`</mark>

Returns the value of the menu item.

### :id

`item:id():` <mark style="color:purple;">`number`</mark>

Returns the unique id of the menu item.

### :list

`item:list():` <mark style="color:purple;">`table`</mark>

Returns the list of items. `combo` / `selectable` menu item objects only.

### :type

`item:type():` <mark style="color:purple;">`string`</mark>

Returns the type of the menu item.

### :override

`item:override(value: any[, ...])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>The value to which the menu item will be set</td></tr><tr><td><strong>...</strong></td><td></td><td></td></tr></tbody></table>

Overrides the item value without changing the menu / config values. If the `value` argument is `nil` or missing, the override is undone.

### :get\_override

`item:get_override():` <mark style="color:purple;">`any`</mark>

Returns the value of the menu item it's overriden to.

### :update

`item:update(...)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>...</strong></td><td><strong><code>any</code></strong></td><td></td></tr></tbody></table>

Updates the values of the menu item.

### :reset

`item:reset()`

Resets the menu item to it's original value.

### :set

`item:set(value: any[, ...])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>The value to which the menu item will be set</td></tr><tr><td><strong>...</strong></td><td></td><td></td></tr></tbody></table>

Sets the value of the menu item.

### :name

`item:name([value: any])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>New name</td></tr></tbody></table>

Gets or sets the name of the menu item.

### :tooltip

`item:tooltip([value: any])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>any</code></strong></td><td>New tooltip text</td></tr></tbody></table>

Gets or sets the tooltip of the menu item (depending on the presence of the `value` parameter).

### :visibility

`item:visibility([state: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>state</strong></td><td><strong><code>boolean</code></strong></td><td>New visibility state</td></tr></tbody></table>

Gets or sets the menu item visibility depending on the value of `state`.

### :disabled

`item:disabled([state: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>state</strong></td><td><strong><code>boolean</code></strong></td><td>New disabled state</td></tr></tbody></table>

Gets or sets the menu item disabled state depending on the value of `state`.

### :set\_callback

`item:set_callback(callback: function[, force_call: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Function that will be called when the menu item is interacted with</td></tr><tr><td><strong>force_call</strong></td><td><strong><code>boolean</code></strong></td><td>Pass <mark style="color:purple;"><code>true</code></mark> to call the callback function after setup</td></tr></tbody></table>

Sets the callback to the specified menu item.

### :unset\_callback

`item:unset_callback(callback: function)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Lua function that was passed to the <mark style="color:purple;"><code>:set_callback</code></mark> function</td></tr></tbody></table>

Unsets the callback that was set via the <mark style="color:purple;">`:set_callback`</mark> function.

### :color\_picker <a href="#render.line" id="render.line"></a>

{% tabs %}
{% tab title="Simple" %}
`item:color_picker([color: color]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Optional. Initial color value</td></tr></tbody></table>
{% endtab %}

{% tab title="Multi-Color" %}
`item:color_picker([colors: table]):` <mark style="color:purple;">`MenuItem`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>colors</strong></td><td><strong><code>table</code></strong></td><td>Table containing tables with a string index, and those tables should contain one or multiple color objects. Check UI examples.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Attaches a color picker to the current menu item object.

### :create

`item:create():` <mark style="color:purple;">`MenuGroup`</mark>

Attaches a group (gear) to the current menu item object.

### :parent

`item:parent():` <mark style="color:purple;">`MenuItem`</mark> / <mark style="color:purple;">`MenuGroup`</mark>

Returns the parent object of the menu item.


# network

## Functions:

### get

`network.get(url: string[, headers: table, callback: function]):` <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>url</strong></td><td><strong><code>string</code></strong></td><td>URL</td></tr><tr><td><strong>headers</strong></td><td><strong><code>table</code></strong></td><td>Headers</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Callback</td></tr></tbody></table>

Sends a GET request to the URL.

### post

`network.post(url: string[, data: table, headers: table, callback: function]):` <mark style="color:purple;">`string`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>url</strong></td><td><strong><code>string</code></strong></td><td>URL</td></tr><tr><td><strong>data</strong></td><td><strong><code>table</code></strong></td><td>Post data</td></tr><tr><td><strong>headers</strong></td><td><strong><code>table</code></strong></td><td>Headers</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>Callback</td></tr></tbody></table>

Sends a POST request to the URL.


# panorama

## Functions:

### loadstring

`panorama.loadstring(js_code: string[, panel: string]):` <mark style="color:purple;">`any`</mark>

<table><thead><tr><th width="150">Name</th><th width="276.6327476178787">Type</th><th width="315.3767817476029">Description</th></tr></thead><tbody><tr><td><strong>js_code</strong></td><td><strong><code>string</code></strong></td><td>String containing JavaScript code</td></tr><tr><td><strong>panel</strong></td><td><strong><code>string</code></strong> (panorama root panel)</td><td>Optional. Panel name</td></tr></tbody></table>

## Accessing API's

`panorama[api]:` <mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="150">Name</th><th width="276.6327476178787">Type</th><th width="315.3767817476029">Description</th></tr></thead><tbody><tr><td><strong>api</strong></td><td><strong><code>string</code></strong></td><td>API name, e.g. GameStateAPI</td></tr></tbody></table>

`panorama[panel][api]:` <mark style="color:purple;">`table`</mark>

<table><thead><tr><th width="150">Name</th><th width="276.6327476178787">Type</th><th width="315.3767817476029">Description</th></tr></thead><tbody><tr><td><strong>panel</strong></td><td><strong><code>string</code></strong> (panorama root panel)</td><td>Panel name</td></tr><tr><td><strong>api</strong></td><td><strong><code>string</code></strong></td><td>API name, e.g. GameStateAPI</td></tr></tbody></table>

```lua
-- Access an API from the default root panel
local MyPersonaAPI = panorama.MyPersonaAPI

print(MyPersonaAPI.GetXuid())

-- Access an API from a specific root panel
local UiToolkitAPI = panorama.CSGOMainMenu.UiToolkitAPI

UiToolkitAPI.CloseAllVisiblePopups()
```


# rage

## Structs:

## 🔗 <mark style="color:blue;">`antiaim`</mark>

### :get\_max\_desync

`rage.antiaim:get_max_desync():` <mark style="color:purple;">`number`</mark>

Returns the maximum amount of desync.

### :get\_rotation

`rage.antiaim:get_rotation([value: boolean]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark>, fake rotation will be returned.</td></tr></tbody></table>

Returns the current anti-aim rotation.

### :get\_target

`rage.antiaim:get_target([return_fr: boolean]):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>return_fr</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark>, freestanding yaw will be returned.</td></tr></tbody></table>

Returns the at target yaw rotation or nil if not available.

### :inverter

`rage.antiaim:inverter([value: boolean]):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. Inverter state.</td></tr></tbody></table>

Gets or sets the state of the anti-aim inverter.

### :override\_hidden\_pitch

`rage.antiaim:override_hidden_pitch(value: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>Hidden pitch value.</td></tr></tbody></table>

Overrides the hidden pitch to the desired value.

### :override\_hidden\_yaw\_offset

`rage.antiaim:override_hidden_yaw_offset(value: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>number</code></strong></td><td>Hidden yaw offset value.</td></tr></tbody></table>

Overrides the hidden yaw offset to the desired value.

## 🔗 <mark style="color:blue;">`exploit`</mark>

### :get

`rage.exploit:get():` <mark style="color:purple;">`number`</mark>

Returns the exploit charge as a unit interval (value in the range \[0, 1]).

### :allow\_charge

`rage.exploit:allow_charge([value: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark>, allows exploit charge. If <mark style="color:purple;"><code>false</code></mark>, blocks exploit charge. Defaults to <mark style="color:purple;"><code>true</code></mark></td></tr></tbody></table>

Allows/blocks exploit charge.

### :allow\_defensive

`rage.exploit:allow_defensive([value: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>value</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark>, allows the cheat to discharge defensive exploit. If <mark style="color:purple;"><code>false</code></mark>, blocks defensive exploit discharge. Defaults to <mark style="color:purple;"><code>true</code></mark></td></tr></tbody></table>

Allows/blocks defensive exploit discharge.

### :force\_teleport

`rage.exploit:force_teleport()`

### :force\_charge

`rage.exploit:force_charge()`


# render

## Functions:

### screen\_size

`render.screen_size():` <mark style="color:purple;">`vector`</mark>

### camera\_position

`render.camera_position():` <mark style="color:purple;">`vector`</mark>

Returns the camera position vector.

### camera\_angles

`render.camera_angles([angles: vector]):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>angles</strong></td><td><strong><code>vector</code></strong></td><td>New camera angles</td></tr></tbody></table>

Returns or sets the camera angles.

### world\_to\_screen

`render.world_to_screen(position: vector):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Position in world space</td></tr></tbody></table>

📌 Note that there is a cleaner alternative, the [`:to_screen`](https://docs-csgo.neverlose.cc/documentation/variables/pages/SCvYOqxhw0Zri5gtCIPa#render.line-22) vector function.

Returns the screen position vector, or nil if the world position is not visible on your screen. This can only be called from the render callback.

### get\_offscreen

`render.get_offscreen(position: vector, radius: number[, accurate: boolean]):` <mark style="color:purple;">`vector`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Position in world space</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Distance from the center of the screen as a percentage in the range [0.0, ∞]</td></tr><tr><td><strong>accurate</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark> then accurate calculations will be used</td></tr></tbody></table>

Returns the <mark style="color:blue;">`position`</mark>, <mark style="color:blue;">`rotation`</mark>, and <mark style="color:blue;">`is_out_of_fov`</mark> arguments or nil on failure.

<mark style="color:blue;">`position`</mark>: Screen coordinates (Returns ellipse-based position if the world position is out of FOV)\ <mark style="color:blue;">`rotation`</mark>: Yaw axis that can be used to rotate drawing stuff\ <mark style="color:blue;">`is_out_of_fov`</mark>: Returns <mark style="color:green;">`true`</mark> if the world position is out of FOV.

### get\_pixel

`render.get_pixel(position: vector)`

{% hint style="warning" %}
Getting the color of the pixel is a heavy process. Do not do it inside callbacks that are called a lot of times per second.
{% endhint %}

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr></tbody></table>

Returns the color of the specified pixel on the screen.

### load\_font

📌 Render any text via the [`draw:text`](#text) function.

{% tabs %}
{% tab title="Size as a number" %}
`render.load_font(name: string, size: number[, flags: string]):` <mark style="color:purple;">`FontObject`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Font that will be initialized</td></tr><tr><td><strong>size</strong></td><td><strong><code>number</code></strong></td><td>Size of the font</td></tr><tr><td><strong>flags</strong></td><td><strong><code>string</code></strong></td><td><mark style="color:purple;"><code>a</code></mark> for anti-aliasing,  <mark style="color:purple;"><code>i</code></mark> for cursive text, and <mark style="color:purple;"><code>b</code></mark> for bold text, <mark style="color:purple;"><code>o</code></mark> for outlined text, <mark style="color:purple;"><code>d</code></mark> for the drop shadow effect.</td></tr></tbody></table>
{% endtab %}

{% tab title="Size as a vector" %}
`render.load_font(name: string, size: vector[, flags: string]):` <mark style="color:purple;">`FontObject`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>name</strong></td><td><strong><code>string</code></strong></td><td>Font that will be initialized</td></tr><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>A vector object containing <mark style="color:blue;"><code>width</code></mark>, <mark style="color:blue;"><code>height</code></mark>, and <mark style="color:blue;"><code>spacing</code></mark>.</td></tr><tr><td><strong>flags</strong></td><td><strong><code>string</code></strong></td><td><mark style="color:purple;"><code>a</code></mark> for anti-aliasing,  <mark style="color:purple;"><code>i</code></mark> for cursive text, and <mark style="color:purple;"><code>b</code></mark> for bold text, <mark style="color:purple;"><code>o</code></mark> for outlined text, <mark style="color:purple;"><code>d</code></mark> for the drop shadow effect, <mark style="color:purple;"><code>u</code></mark> to enable extra symbol support.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Returns the `FontObject` struct or nil on failure.

### load\_image

📌 Render any image via the [`:texture`](#texture) function.

`render.load_image(contents: string, size: vector):` <mark style="color:purple;">`ImgObject`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>contents</strong></td><td><strong><code>string</code></strong></td><td>Raw image file contents</td></tr><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>Size of the image</td></tr></tbody></table>

Returns the `ImgObject` struct or nil on failure. Supports JPG, PNG, BMP, SVG, and GIF formats.

### load\_image\_rgba

📌 Render any image via the [`:texture`](#texture) function.

`render.load_image_rgba(contents: string, size: vector):` <mark style="color:purple;">`ImgObject`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>contents</strong></td><td><strong><code>string</code></strong></td><td><code>RGBA</code> buffer (<code>HEX</code> encoded)</td></tr><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>Size of the image</td></tr></tbody></table>

Returns the `ImgObject` struct or nil on failure.

### load\_image\_from\_file

📌 Render any image via the [`:texture`](#texture) function.

`render.load_image_from_file(path: string, size: vector):` <mark style="color:purple;">`ImgObject`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>path</strong></td><td><strong><code>string</code></strong></td><td>Path to the image</td></tr><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>Size of the image</td></tr></tbody></table>

> ℹ️ Loading images from game resources is supported.
>
> Example: `render.load_image_from_file 'materials/panorama/images/icons/ui/warning.svg'`

Returns the `ImgObject` struct or nil on failure. Supports JPG, PNG, BMP, SVG, and GIF formats.

### measure\_text

`render.measure_text(font: FontObject[, flags: string], text: string):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>font</strong></td><td><strong><code>FontObject</code></strong></td><td>Font object or <mark style="color:blue;"><code>1</code></mark> for <mark style="color:purple;"><code>Default</code></mark> font, <br><mark style="color:blue;"><code>2</code></mark> for <mark style="color:purple;"><code>Small</code></mark> font, or <mark style="color:blue;"><code>3</code></mark> for <mark style="color:purple;"><code>Console</code></mark> font</td></tr><tr><td><strong>flags</strong></td><td><strong><code>string</code></strong></td><td>Optional. <mark style="color:purple;"><code>s</code></mark> for DPI scaled text</td></tr><tr><td><strong>text</strong></td><td><strong><code>string</code></strong></td><td>Text that will be measured</td></tr></tbody></table>

Returns the measured size of the text.

### highlight\_hitbox

`render.highlight_hitbox(entity: entity, hitbox: number, color: color)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>The player whose hitbox(es) are to be highlighted.</td></tr><tr><td><strong>hitbox</strong></td><td><strong><code>number</code></strong></td><td>Hitbox index (an integer between 0 and 18). A table with hitbox indices can also be used to highlight multiple hitboxes. Pass 19 to highlight every hitbox.</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>The color with which you want to highlight the hitbox(es).</td></tr></tbody></table>

Highlights the specified hitbox / hitboxes.

### get\_scale

`render.get_scale(type: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>type</strong></td><td><strong><code>number</code></strong></td><td><p>The type of DPI scale to return.</p><p><mark style="color:purple;"><code>1</code></mark> - Menu Scale, <mark style="color:purple;"><code>2</code></mark> - ESP Scale.</p></td></tr></tbody></table>

Returns the DPI scale value.

## Structs

### 🔗 <mark style="color:blue;">`ImgObject`</mark>

#### width

`img.width` `:` <mark style="color:purple;">`number`</mark>

#### height

`img.height` `:` <mark style="color:purple;">`number`</mark>

#### resolution

`img.resolution` `:` <mark style="color:purple;">`number`</mark>

### 🔗 <mark style="color:blue;">`FontObject`</mark>

#### width

`font.width` `:` <mark style="color:purple;">`number`</mark>

#### height

`font.height` `:` <mark style="color:purple;">`number`</mark>

#### spacing

`font.spacing` `:` <mark style="color:purple;">`number`</mark>

#### :set\_size

{% tabs %}
{% tab title="Size as a number" %}
`font:set_size(size: number)`<br>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>size</strong></td><td><strong><code>number</code></strong></td><td>New size of the font</td></tr></tbody></table>
{% endtab %}

{% tab title="Size as a vector" %}
`font:set_size(size: vector)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>A vector object containing <mark style="color:blue;"><code>width</code></mark>, <mark style="color:blue;"><code>height</code></mark>, and <mark style="color:blue;"><code>spacing</code></mark>.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Sets the new font size.

## Draw functions

### blur

`render.blur(position_a: vector, position_b: vector, strength: number, alpha: number[, rounding: number])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position_a</strong></td><td><strong><code>vector</code></strong></td><td>Start position</td></tr><tr><td><strong>position_b</strong></td><td><strong><code>vector</code></strong></td><td>End position</td></tr><tr><td><strong>strength</strong></td><td><strong><code>number</code></strong></td><td>Blur strength</td></tr><tr><td><strong>alpha</strong></td><td><strong><code>number</code></strong></td><td>Alpha percentage in the range [0.0, 1.0]</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>Optional. Rounding of the blur rectangle in pixels</td></tr></tbody></table>

### line

`render.line(position_a: vector, position_b: vector, color: color)`

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position_a</strong></td><td><strong><code>vector</code></strong></td><td>Start position</td></tr><tr><td><strong>position_b</strong></td><td><strong><code>vector</code></strong></td><td>End position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the line</td></tr></tbody></table>

### poly

`render.poly(color: color, positions: vector[, ...])`

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the polyline</td></tr><tr><td><strong>positions</strong></td><td><strong><code>vector</code></strong></td><td>Screen positions</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated vectors to concatenate with <code>positions</code></td></tr></tbody></table>

### poly\_blur

`render.poly_blur(opacity: number, strength: number, positions: vector[, ...])`

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>opacity</strong></td><td><strong><code>number</code></strong></td><td>Opacity percentage in the range [0.0, 1.0]</td></tr><tr><td><strong>strength</strong></td><td><strong><code>number</code></strong></td><td>Blur strength</td></tr><tr><td><strong>positions</strong></td><td><strong><code>vector</code></strong></td><td>Screen positions</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated vectors to concatenate with <code>positions</code></td></tr></tbody></table>

### poly\_line

`render.poly_line(color: color, positions: vector[, ...])`

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the polyline</td></tr><tr><td><strong>positions</strong></td><td><strong><code>vector</code></strong></td><td>Screen positions</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated vectors to concatenate with <code>positions</code></td></tr></tbody></table>

### rect

`render.rect(position_a: vector, position_b: vector, color: color[, rounding: number, no_clamp: boolean])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position_a</strong></td><td><strong><code>vector</code></strong></td><td>Start position</td></tr><tr><td><strong>position_b</strong></td><td><strong><code>vector</code></strong></td><td>End position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the rectangle</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>Optional. Rounding of the rectangle in pixels</td></tr><tr><td><strong>no_clamp</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark>, negative sizes will be allowed</td></tr></tbody></table>

### rect\_outline

`render.rect_outline(position_a: vector, position_b: vector, color: color[, thickness: number, rounding: number, no_clamp: boolean])`

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position_a</strong></td><td><strong><code>vector</code></strong></td><td>Start position</td></tr><tr><td><strong>position_b</strong></td><td><strong><code>vector</code></strong></td><td>End position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the rectangle</td></tr><tr><td><strong>thickness</strong></td><td><strong><code>number</code></strong></td><td>Optional. Thickness of the rectangle in pixels</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>Optional. Rounding of the rectangle in pixels</td></tr><tr><td><strong>no_clamp</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. If <mark style="color:purple;"><code>true</code></mark>, <code>position_a &#x3C; position_b</code> will be allowed</td></tr></tbody></table>

### gradient

`render.gradient(position_a: vector, position_b: vector, top_left: color, top_right: color, bottom_left: color, bottom_right: color[, rounding: number])`

<table><thead><tr><th width="167.11046639986603">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position_a</strong></td><td><strong><code>vector</code></strong></td><td>Start position</td></tr><tr><td><strong>position_b</strong></td><td><strong><code>vector</code></strong></td><td>End position</td></tr><tr><td><strong>top_left</strong></td><td><strong><code>color</code></strong></td><td>Color of the top left rectangle position</td></tr><tr><td><strong>top_right</strong></td><td><strong><code>color</code></strong></td><td>Color of the top right rectangle position</td></tr><tr><td><strong>bottom_left</strong></td><td><strong><code>color</code></strong></td><td>Color of the bottom left rectangle position</td></tr><tr><td><strong>bottom_right</strong></td><td><strong><code>color</code></strong></td><td>Color of the bottom right rectangle position</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>Optional. Rounding of the gradient in pixels</td></tr></tbody></table>

### circle

`render.circle(position: vector, color: color, radius: number, start_deg: number, pct: number)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>type</code></strong></td><td>Screen position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the circle</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Radius of the circle in pixels</td></tr><tr><td><strong>start_deg</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:purple;"><code>0</code></mark> is the right side, <mark style="color:purple;"><code>90</code></mark> is the bottom, <mark style="color:purple;"><code>180</code></mark> is the left, <mark style="color:purple;"><code>270</code></mark> is the top</td></tr><tr><td><strong>pct</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0-1.0] determining how full the circle is</td></tr></tbody></table>

### circle\_outline

`render.circle_outline(position: vector, color: color, radius: number, start_deg: number, pct: number[, thickness: number])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the circle</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Radius of the circle in pixels</td></tr><tr><td><strong>start_deg</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:purple;"><code>0</code></mark> is the right side, <mark style="color:purple;"><code>90</code></mark> is the bottom, <mark style="color:purple;"><code>180</code></mark> is the left, <mark style="color:purple;"><code>270</code></mark> is the top</td></tr><tr><td><strong>pct</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0-1.0] determining how full the circle is</td></tr><tr><td><strong>thickness</strong></td><td><strong><code>number</code></strong></td><td>Optional. Thickness of the outline in pixels</td></tr></tbody></table>

### circle\_gradient

`render.circle_gradient(position: vector, color_outer: color, color_inner: color, radius: number, start_deg: number, pct: number)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>color_outer</strong></td><td><strong><code>color</code></strong></td><td>Outer color of the circle</td></tr><tr><td><strong>color_inner</strong></td><td><strong><code>color</code></strong></td><td>Inner color of the circle</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Radius of the circle in pixels</td></tr><tr><td><strong>start_deg</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:purple;"><code>0</code></mark> is the right side, <mark style="color:purple;"><code>90</code></mark> is the bottom, <mark style="color:purple;"><code>180</code></mark> is the left, <mark style="color:purple;"><code>270</code></mark> is the top</td></tr><tr><td><strong>pct</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0-1.0] determining how full the circle is</td></tr></tbody></table>

### circle\_3d

`render.circle_3d(position: vector, color: color, radius: number, start_deg: number, pct: number[, outline: boolean])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the circle</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Radius of the circle in pixels</td></tr><tr><td><strong>start_deg</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:purple;"><code>0</code></mark> is the right side, <mark style="color:purple;"><code>90</code></mark> is the bottom, <mark style="color:purple;"><code>180</code></mark> is the left, <mark style="color:purple;"><code>270</code></mark> is the top</td></tr><tr><td><strong>pct</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0-1.0] determining how full the circle is</td></tr><tr><td><strong>outline</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. Render the circle outline</td></tr></tbody></table>

### circle\_3d\_outline

`render.circle_3d_outline(position: vector, color: color, radius: number, start_deg: number, pct: number[, thickness: number])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the circle</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Radius of the circle in pixels</td></tr><tr><td><strong>start_deg</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:purple;"><code>0</code></mark> is the right side, <mark style="color:purple;"><code>90</code></mark> is the bottom, <mark style="color:purple;"><code>180</code></mark> is the left, <mark style="color:purple;"><code>270</code></mark> is the top</td></tr><tr><td><strong>pct</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0-1.0] determining how full the circle is</td></tr><tr><td><strong>thickness</strong></td><td><strong><code>number</code></strong></td><td>Thickness of the outline in pixels</td></tr></tbody></table>

### circle\_3d\_gradient

`render.circle_3d_gradient(position: vector, color_outer: color, color_inner: color, radius: number, start_deg: number, pct: number)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>color_outer</strong></td><td><strong><code>color</code></strong></td><td>Outer color of the circle</td></tr><tr><td><strong>color_inner</strong></td><td><strong><code>color</code></strong></td><td>Inner color of the circle</td></tr><tr><td><strong>radius</strong></td><td><strong><code>number</code></strong></td><td>Radius of the circle in pixels</td></tr><tr><td><strong>start_deg</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:purple;"><code>0</code></mark> is the right side, <mark style="color:purple;"><code>90</code></mark> is the bottom, <mark style="color:purple;"><code>180</code></mark> is the left, <mark style="color:purple;"><code>270</code></mark> is the top</td></tr><tr><td><strong>pct</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0-1.0] determining how full the circle is</td></tr></tbody></table>

### text

📌 Render any text via the [`:load_font`](#load_font) function.

`render.text(font: FontObject, position: vector, color: color, flags: string, text:any[, ...])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>font</strong></td><td><strong><code>FontObject</code></strong></td><td>Font object or <mark style="color:blue;"><code>1</code></mark> for <mark style="color:purple;"><code>Default</code></mark> font, <br><mark style="color:blue;"><code>2</code></mark> for <mark style="color:purple;"><code>Small</code></mark> font, <mark style="color:blue;"><code>3</code></mark> for <mark style="color:purple;"><code>Console</code></mark> font, or <mark style="color:blue;"><code>4</code></mark> for <mark style="color:purple;"><code>Bold</code></mark> font</td></tr><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Color of the text</td></tr><tr><td><strong>flags</strong></td><td><strong><code>string</code></strong></td><td><p><mark style="color:purple;"><code>c</code></mark> for centered text, <mark style="color:purple;"><code>r</code></mark> for right-aligned text, <mark style="color:purple;"><code>s</code></mark> for DPI scaled text.</p><p><mark style="color:purple;"><code>nil</code></mark> can be specified for normal uncentered text.</p></td></tr><tr><td><strong>text</strong></td><td><strong><code>any</code></strong></td><td>Text that will be drawn</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated vectors to concatenate with <code>text</code></td></tr></tbody></table>

Draws the specified text.

### texture

📌 Create the texture via the [`:load_image`](#load_image) function.

`render.texture(texture: ImgObject, position: vector[, size: vector, color: color, mode: string, rounding: number])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>texture</strong></td><td><strong><code>ImgObject</code></strong></td><td>Image object</td></tr><tr><td><strong>position</strong></td><td><strong><code>vector</code></strong></td><td>Screen position</td></tr><tr><td><strong>size</strong></td><td><strong><code>vector</code></strong></td><td>Optional. Size of the texture</td></tr><tr><td><strong>color</strong></td><td><strong><code>color</code></strong></td><td>Optional. Color of the texture</td></tr><tr><td><strong>mode</strong></td><td><strong><code>string</code></strong></td><td>Optional. <mark style="color:purple;"><code>f</code></mark> for fill, <mark style="color:purple;"><code>r</code></mark> for repeat</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>Optional. Roundness of the texture</td></tr></tbody></table>

### push\_rotation

`render.push_rotation(degrees: number)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>degrees</strong></td><td><strong><code>number</code></strong></td><td>Rotation degrees (0 - 360)</td></tr></tbody></table>

Applies the rotation for all subsequent elements.

### pop\_rotation

`render.pop_rotation()`

Discards an early set rotation.

### push\_clip\_rect

`render.push_clip_rect(pos_a: vector, pos_b: vector[, intersect: boolean])`

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>pos_a</strong></td><td><strong><code>vector</code></strong></td><td>Screen position of point A</td></tr><tr><td><strong>pos_b</strong></td><td><strong><code>vector</code></strong></td><td>Screen position of point B</td></tr><tr><td><strong>intersect</strong></td><td><strong><code>boolean</code></strong></td><td>Optional. Allow intersections with other clip regions</td></tr></tbody></table>

Applies the clip region to the given rectangle for all subsequent elements.

### pop\_clip\_rect

`render.pop_clip_rect()`

Discards an early set rectangle clipping region.

### shadow

`render.shadow(pos_a: vector, pos_b: vector, clr: color[, thickness: number, offset: number, rounding: number])`

<table><thead><tr><th width="159.95526570812686">Name</th><th width="150">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>pos_a</strong></td><td><strong><code>vector</code></strong></td><td>Screen position of point A</td></tr><tr><td><strong>pos_b</strong></td><td><strong><code>vector</code></strong></td><td>Screen position of point B</td></tr><tr><td><strong>clr</strong></td><td><strong><code>color</code></strong></td><td>The color of the shadow</td></tr><tr><td><strong>thickness</strong></td><td><strong><code>number</code></strong></td><td>The thickness of the shadow</td></tr><tr><td><strong>offset</strong></td><td><strong><code>number</code></strong></td><td>Shadow offset</td></tr><tr><td><strong>rounding</strong></td><td><strong><code>number</code></strong></td><td>The rounding of the shadow rectangle</td></tr></tbody></table>

Draws a shadow rectangle.


# utils

## Functions:

### console\_exec

`utils.console_exec(cmd: string[, ...])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>cmd</strong></td><td><strong><code>string</code></strong></td><td>The console command(s) to execute</td></tr><tr><td><strong>...</strong></td><td></td><td>Comma-separated arguments to concatenate with <strong>cmd</strong></td></tr></tbody></table>

Executes a console command. Multiple commands can be combined with ';'. Be careful when passing user input (including usernames) to it.

### execute\_after

`utils.execute_after(delay: number, callback: function[, ...])`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>delay</strong></td><td><strong><code>number</code></strong></td><td>Time in seconds to wait before calling callback</td></tr><tr><td><strong>callback</strong></td><td><strong><code>function</code></strong></td><td>The Lua function that will be called after the delay</td></tr><tr><td><strong>...</strong></td><td></td><td>Arguments that will be passed to the callback</td></tr></tbody></table>

Executes the callback after delay seconds, passing the arguments to it.

### net\_channel

`utils.net_channel():` <mark style="color:purple;">`NetChannel`</mark>

Returns the [`NetChannel`](#netchannel) struct.

### trace\_line

{% embed url="<https://developer.valvesoftware.com/wiki/UTIL_TraceLine>" %}

`utils.trace_line(from: vector, to: vector[, skip: entity/table/function, mask: number, type: number]):` <mark style="color:purple;">`trace`</mark>

<table><thead><tr><th width="150">Name</th><th width="175.17772006464614">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>from</strong></td><td><strong><code>vector</code></strong></td><td>Vector to start tracing from</td></tr><tr><td><strong>to</strong></td><td><strong><code>vector</code></strong></td><td>Vector to trace to</td></tr><tr><td><strong>skip</strong></td><td><strong><code>entity</code></strong>, <strong><code>table</code></strong>, <strong><code>function</code></strong></td><td>Optional. Entity skipping options</td></tr><tr><td><strong>mask</strong></td><td><strong><code>number</code></strong></td><td>Optional. Trace mask</td></tr><tr><td><strong>type</strong></td><td><strong><code>number</code></strong></td><td>Optional. Trace type [0-3]<br><mark style="color:blue;"><code>0</code></mark>: Trace everything <code>[Default]</code><br><mark style="color:blue;"><code>1</code></mark>: Trace world only<br><mark style="color:blue;"><code>2</code></mark>: Trace entities only<br><mark style="color:blue;"><code>3</code></mark>: Trace everything filter props</td></tr></tbody></table>

> 📌 The `skip` argument can either be an `entity` object, a table with `entity` objects, or a function, like the ShouldHitEntity callback. If you use it as a callback, you can access the `entity` and `contents_mask` by adding them to the function arguments. Inside the callback, return true if tracing should not skip the entity, otherwise return false.

Returns a [`trace`](#struct-trace) struct containing all the information.

### trace\_hull

`utils.trace_hull(from: vector, to: vector, mins: vector, maxs: vector[, skip: entity/table/function, mask: number, type: number]):` <mark style="color:purple;">`trace`</mark>

<table><thead><tr><th width="150">Name</th><th width="174.17772006464614">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>from</strong></td><td><strong><code>vector</code></strong></td><td>Vector to start tracing from</td></tr><tr><td><strong>to</strong></td><td><strong><code>vector</code></strong></td><td>Vector to trace to</td></tr><tr><td><strong>mins</strong></td><td><strong><code>vector</code></strong></td><td>Hull mins</td></tr><tr><td><strong>maxs</strong></td><td><strong><code>vector</code></strong></td><td>Hull maxs</td></tr><tr><td><strong>skip</strong></td><td><strong><code>entity</code></strong>, <strong><code>table</code></strong>, <strong><code>function</code></strong></td><td>Optional. Entity skipping options</td></tr><tr><td><strong>mask</strong></td><td><strong><code>number</code></strong></td><td>Optional. Trace mask</td></tr><tr><td><strong>type</strong></td><td><strong><code>number</code></strong></td><td>Optional. Trace type [0-3]<br><mark style="color:blue;"><code>0</code></mark>: Trace everything <code>[Default]</code><br><mark style="color:blue;"><code>1</code></mark>: Trace world only<br><mark style="color:blue;"><code>2</code></mark>: Trace entities only<br><mark style="color:blue;"><code>3</code></mark>: Trace everything filter props</td></tr></tbody></table>

> 📌 The `skip` argument can either be an `entity` object, a table with `entity` objects, or a function, like the ShouldHitEntity callback. If you use it as a callback, you can access the `entity` and `contents_mask` by adding them to the function arguments. Inside the callback, return true if tracing should not skip the entity, otherwise return false.

Returns a [`trace`](#struct-trace) struct containing all the information.

### trace\_bullet

`utils.trace_bullet(from_entity: entity, from: vector, to: vector[, skip: entity/table/function]):` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`trace`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>from_entity</strong></td><td><strong><code>entity</code></strong></td><td>Player whose weapon will be used for this trace</td></tr><tr><td><strong>from</strong></td><td><strong><code>vector</code></strong></td><td>Vector to start tracing from</td></tr><tr><td><strong>to</strong></td><td><strong><code>vector</code></strong></td><td>Vector to trace to</td></tr><tr><td><strong>skip</strong></td><td><strong><code>entity</code></strong>, <strong><code>table</code></strong>, <strong><code>function</code></strong></td><td>Optional. Entity skipping options. If not passed, the skip entity will be <code>from_entity</code></td></tr></tbody></table>

> 📌 The `skip` argument can either be an `entity` object, a table with `entity` objects, or a function, like the ShouldHitEntity callback. If you use it as a callback, you can access the `entity` and `contents_mask` by adding them to the function arguments. Inside the callback, return true if tracing should not skip the entity, otherwise return false.

Returns the `damage`, [`trace`](#struct-trace) arguments.

#### 🔗 struct <mark style="color:blue;">`trace`</mark>

<table><thead><tr><th width="221.87840137519683">Name</th><th width="150">Type</th><th width="341.1829205510523">Description</th></tr></thead><tbody><tr><td><strong>start_pos</strong></td><td><strong><code>vector</code></strong></td><td>Start position</td></tr><tr><td><strong>end_pos</strong></td><td><strong><code>vector</code></strong></td><td>Final position</td></tr><tr><td><strong>plane</strong></td><td><strong><code>table</code></strong></td><td>Surface normal at impact. Contains <mark style="color:blue;"><code>normal</code></mark>, <mark style="color:blue;"><code>dist</code></mark>, <mark style="color:blue;"><code>type</code></mark>, and <mark style="color:blue;"><code>signbits</code></mark> values</td></tr><tr><td><strong>fraction</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0, 1.0]. How far the trace went before hitting something. <mark style="color:blue;"><code>1.0</code></mark> - didn't hit anything</td></tr><tr><td><strong>contents</strong></td><td><strong><code>number</code></strong></td><td>Contents on other side of surface hit</td></tr><tr><td><strong>disp_flags</strong></td><td><strong><code>number</code></strong></td><td>Displacement flags for marking surfaces with data</td></tr><tr><td><strong>all_solid</strong></td><td><strong><code>boolean</code></strong></td><td>Returns <mark style="color:purple;"><code>true</code></mark> if the plane is invalid</td></tr><tr><td><strong>start_solid</strong></td><td><strong><code>boolean</code></strong></td><td>Returns <mark style="color:purple;"><code>true</code></mark> if the initial point was in a solid area</td></tr><tr><td><strong>fraction_left_solid</strong></td><td><strong><code>number</code></strong></td><td>Percentage in the range [0.0, 1.0]. How far the trace went before leaving solid. Only valid if we started in solid</td></tr><tr><td><strong>surface</strong></td><td><strong><code>table</code></strong></td><td>Surface hit (impact surface). Contains <mark style="color:blue;"><code>name</code></mark>, <mark style="color:blue;"><code>props</code></mark>, and <mark style="color:blue;"><code>flags</code></mark> values</td></tr><tr><td><strong>hitgroup</strong></td><td><strong><code>number</code></strong></td><td><mark style="color:blue;"><code>0</code></mark> - generic, non-zero is specific body part</td></tr><tr><td><strong>physics_bone</strong></td><td><strong><code>number</code></strong></td><td>Physics bone that was hit by the trace</td></tr><tr><td><strong>world_surface_index</strong></td><td><strong><code>number</code></strong></td><td>Index of the msurface2_t, if applicable</td></tr><tr><td><strong>entity</strong></td><td><strong><code>entity</code></strong></td><td>Entity that was hit by the trace</td></tr><tr><td><strong>hitbox</strong></td><td><strong><code>number</code></strong></td><td>Box that was hit by the trace</td></tr><tr><td><strong>did_hit</strong></td><td><strong><code>function</code></strong></td><td>Returns <mark style="color:purple;"><code>true</code></mark> if there was any kind of impact at all</td></tr><tr><td><strong>did_hit_world</strong></td><td><strong><code>function</code></strong></td><td>Returns <mark style="color:purple;"><code>true</code></mark> if the <code>entity</code> points at the world entity</td></tr><tr><td><strong>did_hit_non_world</strong></td><td><strong><code>function</code></strong></td><td>Returns <mark style="color:purple;"><code>true</code></mark> if the trace hit something and it wasn't the world</td></tr><tr><td><strong>is_visible</strong></td><td><strong><code>function</code></strong></td><td>Returns <mark style="color:purple;"><code>true</code></mark> if the final position is visible</td></tr></tbody></table>

### opcode\_scan

`utils.opcode_scan(module: string, signature: string[, offset: number]):` <mark style="color:purple;">`userdata`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>module</strong></td><td><strong><code>string</code></strong></td><td>Module name, in which the signature will be scanned.</td></tr><tr><td><strong>signature</strong></td><td><strong><code>string</code></strong></td><td>IDA style signature, the wildcard is "<mark style="color:yellow;"><code>?</code></mark>"</td></tr><tr><td><strong>offset</strong></td><td><strong><code>number</code></strong></td><td>Optional offset to apply to the pointer address.</td></tr></tbody></table>

Returns a pointer to the specified pattern if it was found. Otherwise returns `nil`.

### create\_interface

`utils.create_interface(module: string, interface: string):` <mark style="color:purple;">`userdata`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>module</strong></td><td><strong><code>string</code></strong></td><td>Module name containing the interface.</td></tr><tr><td><strong>interface</strong></td><td><strong><code>string</code></strong></td><td>Interface name.</td></tr></tbody></table>

Returns a pointer to the specified interface if it was found. Otherwise returns `nil`.

### get\_netvar\_offset

`utils.get_netvar_offset(table: string, prop: string):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>table</strong></td><td><strong><code>string</code></strong></td><td>Datatable name</td></tr><tr><td><strong>prop</strong></td><td><strong><code>string</code></strong></td><td>Prop name</td></tr></tbody></table>

Returns the offset of the specified prop. Can be used to manually navigate to the net prop.

### get\_vfunc

`utils.get_vfunc(index: number, ...):` <mark style="color:purple;">`function`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>index</strong></td><td><strong><code>number</code></strong></td><td>Virtual table index of the function.</td></tr><tr><td><strong>...</strong></td><td></td><td>FFI C Type definition.</td></tr></tbody></table>

Creates and returns a wrapper function that calls a virtual table function on the specified index.

### get\_vfunc

`utils.get_vfunc(module: string, interface: string, index: number, ...):` <mark style="color:purple;">`function`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>module</strong></td><td><strong><code>string</code></strong></td><td>Module name containing the interface.</td></tr><tr><td><strong>interface</strong></td><td><strong><code>string</code></strong></td><td>Interface name.</td></tr><tr><td><strong>index</strong></td><td><strong><code>number</code></strong></td><td>Virtual table index of the function.</td></tr><tr><td><strong>...</strong></td><td></td><td>FFI C Type definition.</td></tr></tbody></table>

Creates and returns a wrapper function that calls a virtual table function from the specified interface on the specified index.

### random\_int

`utils.random_int(min: number, max: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>min</strong></td><td><strong><code>number</code></strong></td><td>Minimum boundary for the random value, included</td></tr><tr><td><strong>max</strong></td><td><strong><code>number</code></strong></td><td>Maximum boundary for the random value, included</td></tr></tbody></table>

Returns a random integer value.

### random\_float

`utils.random_float(min: number, max: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>min</strong></td><td><strong><code>number</code></strong></td><td>Minimum boundary for the random value, included</td></tr><tr><td><strong>max</strong></td><td><strong><code>number</code></strong></td><td>Maximum boundary for the random value, included</td></tr></tbody></table>

Returns a random float value.

### random\_seed

`utils.random_seed(seed: number)`

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>seed</strong></td><td><strong><code>number</code></strong></td><td>New random seed value</td></tr></tbody></table>

Sets the new random seed.

## 🔗 <mark style="color:blue;">`NetChannel`</mark>

{% hint style="info" %}
Access the struct via [<mark style="color:purple;">`.net_channel`</mark>](#net_channel)function

* `FLOW:`<mark style="color:green;">`OUTGOING`</mark>` ``= 0`
* `FLOW:`<mark style="color:green;">`INCOMING`</mark>` ``= 1`
  {% endhint %}

### time

`net.time` `:` <mark style="color:purple;">`number`</mark>

Current network time.

### time\_connected

`net.time_connected` `:` <mark style="color:purple;">`number`</mark>

Connection time in seconds.

### time\_since\_last\_received

`net.time_since_last_received` `:` <mark style="color:purple;">`number`</mark>

Time since last received packet in seconds.

### is\_loopback

`net.is_loopback` `:` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if server is a loopback (local server).

### is\_playback

`net.is_playback` `:` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if demo is being played.

### is\_timing\_out

`net.is_timing_out` `:` <mark style="color:purple;">`boolean`</mark>

Returns <mark style="color:green;">`true`</mark> if client is timing out.

### sequence\_nr\[<mark style="color:blue;">`flow`</mark>]

`net.sequence_nr[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.sequence_nr[1]` `:` <mark style="color:purple;">`number`</mark>

Last sent sequence number.

### latency\[<mark style="color:blue;">`flow`</mark>]

`net.latency[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.latency[1]` `:` <mark style="color:purple;">`number`</mark>

Current latency (RTT), more accurate but jittering.

### avg\_latency\[<mark style="color:blue;">`flow`</mark>]

`net.avg_latency[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.avg_latency[1]` `:` <mark style="color:purple;">`number`</mark>

Average latency in seconds.

### loss\[<mark style="color:blue;">`flow`</mark>]

`net.loss[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.loss[1]` `:` <mark style="color:purple;">`number`</mark>

Percentage in the range \[0.0, 1.0] of the current packet loss.

### choke\[<mark style="color:blue;">`flow`</mark>]

`net.choke[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.choke[1]` `:` <mark style="color:purple;">`number`</mark>

Percentage in the range \[0.0, 1.0] of the current packet choke.

### packets\[<mark style="color:blue;">`flow`</mark>]

`net.packets[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.packets[1]` `:` <mark style="color:purple;">`number`</mark>

Average amount of packets/sec.

### data\[<mark style="color:blue;">`flow`</mark>]

`net.data[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.data[1]` `:` <mark style="color:purple;">`number`</mark>

Data flow in bytes/sec.

### total\_packets\[<mark style="color:blue;">`flow`</mark>]

`net.total_packets[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.total_packets[1]` `:` <mark style="color:purple;">`number`</mark>

Total amount of packets/sec.

### total\_data\[<mark style="color:blue;">`flow`</mark>]

`net.total_data[0]` `:` <mark style="color:purple;">`number`</mark>\
`net.total_data[1]` `:` <mark style="color:purple;">`number`</mark>

Total data flow in bytes/sec.

### :get\_server\_info

`net:get_server_info():` <mark style="color:purple;">`table`</mark>

Returns a table containing <mark style="color:blue;">`rate`</mark>, <mark style="color:blue;">`name`</mark>, <mark style="color:blue;">`address`</mark>, <mark style="color:blue;">`frame_time`</mark>, and <mark style="color:blue;">`deviation`</mark> (or nil on failure).

### :is\_valid\_packet

`net:is_valid_packet(flow: number, frame: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>flow</strong></td><td><strong><code>number</code></strong></td><td>Channel (Flow)</td></tr><tr><td><strong>frame</strong></td><td><strong><code>number</code></strong></td><td>Sequence number</td></tr></tbody></table>

Returns <mark style="color:green;">`true`</mark> if the packet is valid.

### :get\_packet\_time

`net:get_packet_time(flow: number, frame: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>flow</strong></td><td><strong><code>number</code></strong></td><td>Channel (Flow)</td></tr><tr><td><strong>frame</strong></td><td><strong><code>number</code></strong></td><td>Sequence number</td></tr></tbody></table>

Returns the time when the packet was sent.

### :get\_packet\_bytes

`net:get_packet_bytes(flow: number, frame: number, group: number):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>flow</strong></td><td><strong><code>number</code></strong></td><td>Channel (Flow)</td></tr><tr><td><strong>frame</strong></td><td><strong><code>number</code></strong></td><td>Sequence number</td></tr><tr><td><strong>group</strong></td><td><strong><code>number</code></strong></td><td>Group of this packet</td></tr></tbody></table>

Returns the group size of this packet.

### :get\_packet\_response\_latency

`net:get_packet_response_latency(flow: number, frame: number):` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="150">Name</th><th width="162.52330706200414">Type</th><th width="410.3276962436035">Description</th></tr></thead><tbody><tr><td><strong>flow</strong></td><td><strong><code>number</code></strong></td><td>Channel (Flow)</td></tr><tr><td><strong>frame</strong></td><td><strong><code>number</code></strong></td><td>Sequence number</td></tr></tbody></table>

Returns `latency_msecs`, `choke` of this packet.


# vector

## Example available!

{% content-ref url="/pages/nlQEeTdmW3KQXC19SkLL" %}
[Vector](/useful-information/script-examples/vector)
{% endcontent-ref %}

## Functions:

### :angles

{% tabs %}
{% tab title="Initialize from" %}
`vec_object:angles(pitch: number, yaw: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="196.60767828800178">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>pitch</strong></td><td><strong><code>number</code></strong></td><td>Pitch component of the angle</td></tr><tr><td><strong>yaw</strong></td><td><strong><code>number</code></strong></td><td>Yaw component of the angle</td></tr></tbody></table>

Converts the angle into a forward vector overwriting the vector's coordinates. Returns itself.
{% endtab %}

{% tab title="Initialize from \[2]" %}
`vec_object:angles(vector: angle):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="196.60767828800178">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>angle</strong></td><td><strong><code>vector</code></strong></td><td>Angle vector component</td></tr></tbody></table>

Converts the angle into a forward vector overwriting the vector's coordinates. Returns itself.
{% endtab %}

{% tab title="Convert to" %}
`vec_object:angles():` <mark style="color:purple;">`vector`</mark>

Returns the angle vector representing the normal of the vector.
{% endtab %}
{% endtabs %}

### :ceil

`vec_object:ceil():` <mark style="color:purple;">`vector`</mark>

Ceils & overwrites the x, y, and z coordinates of a vector. Returns itself.

### :clone

`vec_object:clone():` <mark style="color:purple;">`vector`</mark>

Creates and returns a copy of the vector.

### :closest\_ray\_point

`vec_object:closest_ray_point(ray_start: vector, ray_end: vector):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="192.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>ray_start</strong></td><td><strong><code>vector</code></strong></td><td>Ray start position</td></tr><tr><td><strong>ray_end</strong></td><td><strong><code>vector</code></strong></td><td>Ray end position</td></tr></tbody></table>

Returns the vector of the closest point along a ray.

### :cross

`vec_object:cross(other: vector):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="189.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to calculate the cross product with</td></tr></tbody></table>

Returns the cross product of two given vectors.

### :dist

`vec_object:dist(other: vector):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="186.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to get the distance to</td></tr></tbody></table>

Returns the Euclidean distance between the two given vectors.

### :dist2d

`vec_object:dist2d(other: vector):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="185.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to get the distance to</td></tr></tbody></table>

Returns the 2D distance to another vector.

### :dist2dsqr

`vec_object:dist2dsqr(other: vector):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="185.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to get the squared distance to</td></tr></tbody></table>

Returns the squared 2D distance to another vector.

### :distsqr

`vec_object:distsqr(other: vector):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="185.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to get the squared distance to</td></tr></tbody></table>

Returns the squared Euclidean distance to another vector.

### :dist\_to\_ray

`vec_object:dist_to_ray(ray_start: vector, ray_direction: vector):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="184.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>ray_start</strong></td><td><strong><code>vector</code></strong></td><td>Ray start position</td></tr><tr><td><strong>ray_direction</strong></td><td><strong><code>vector</code></strong></td><td>Ray direction</td></tr></tbody></table>

Returns the distance to a ray.

### :dot

`vec_object:dot(other: vector):` <mark style="color:purple;">`number`</mark>

<table><thead><tr><th width="192.21824447972227">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to calculate the dot product with</td></tr></tbody></table>

Returns the dot product of the two given vectors.

### :floor

`vec_object:floor():` <mark style="color:purple;">`vector`</mark>

Rounds the x, y, and z coordinates of the vector down to the largest integer that is less than or equal. Returns itself.

### :in\_range

`vec_object:in_range(other: vector, range: number):` <mark style="color:purple;">`boolean`</mark>

<table><thead><tr><th width="192.72764796667107">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to calculate the distance to</td></tr><tr><td><strong>range</strong></td><td><strong><code>number</code></strong></td><td>The distance</td></tr></tbody></table>

Returns true if the vector is within the given distance to another vector.

### :init

`vec_object:init(x: number, y: number, z: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th width="193.60767828800178">Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>x</strong></td><td><strong><code>number</code></strong></td><td>New X coordinate</td></tr><tr><td><strong>y</strong></td><td><strong><code>number</code></strong></td><td>New Y coordinate</td></tr><tr><td><strong>z</strong></td><td><strong><code>number</code></strong></td><td>New Z coordinate</td></tr></tbody></table>

Overwrites the vector's coordinates. Returns itself.

### :length

`vec_object:length():` <mark style="color:purple;">`number`</mark>

Returns the Euclidean length of the vector.

### :length2d

`vec_object:length2d():` <mark style="color:purple;">`number`</mark>

Returns the length of the vector in two dimensions, without the Z axis.

### :length2dsqr

`vec_object:length2dsqr():` <mark style="color:purple;">`number`</mark>

Returns the squared length of the vectors x and y value.

### :lengthsqr

`vec_object:lengthsqr():` <mark style="color:purple;">`number`</mark>

Returns the squared length of the vector.

### :lerp

`vec_object:lerp(other: vector, weight: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to interpolate to</td></tr><tr><td><strong>weight</strong></td><td><strong><code>number</code></strong></td><td>A value between 0 and 1 that indicates the weight of <strong>other</strong></td></tr></tbody></table>

Returns the linearly interpolated vector between two vectors by the specified weight.

### :normalize

`vec_object:normalize():` <mark style="color:purple;">`number`</mark>

Normalizes the vector and returns the length of the vector.

### :normalized

`vec_object:normalized():` <mark style="color:purple;">`vector`</mark>

Returns a vector with the same direction as the specified vector, but with a length of one.

### :scale

`vec_object:scale(scalar: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>scalar</strong></td><td>number</td><td>The scalar value</td></tr></tbody></table>

Multiplies the vector by the specified scalar.

### :scaled

`vec_object:scaled(scalar: number):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>scalar</strong></td><td>number</td><td>The scalar value.</td></tr></tbody></table>

Returns a copy of the vector multiplied by the specified scalar.

### :to

`vec_object:to(other: vector):` <mark style="color:purple;">`vector`</mark>

<table><thead><tr><th>Name</th><th width="150">Type</th><th width="395.7341676883734">Description</th></tr></thead><tbody><tr><td><strong>other</strong></td><td><strong><code>vector</code></strong></td><td>The vector to get the direction to.</td></tr></tbody></table>

Returns the forward vector from itself to another vector.

### :to\_screen

`vec_object:to_screen():` <mark style="color:purple;">`vector`</mark>

Returns a vector containing the coordinates where the specified position vector appears on the screen.

### :unpack

`vec_object:unpack():` <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>, <mark style="color:purple;">`number`</mark>

Returns the x, y, and z coordinates of the vector. Note that these fields can be accessed by indexing x, y, and z.

### :vectors

`vec_object:vectors():` <mark style="color:purple;">`vector`</mark>, <mark style="color:purple;">`vector`</mark>

Returns the right and up vector of a forward vector.


