Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Methods in this namespace are accessed with the . operator, not the usual : operator.
Only call these inside the createMove callback!
Function
Simulates a bullet fired from a specific weapon.
Arguments
Returns
Example
Function
Scales up the damage from a weapon given a hitgroup and, optionally, a player.
Arguments
Returns
Example
origin
Where the bullet is coming from
delta
The direction the bullet is going, computed as end_point - origin_point
boolean
If there was an error during simulation.
The penetration data
local eye_position = local_player:GetEyePos()
local weapon = local_player:GetActiveWeapon()
local enemy_position = enemy:GetHitboxCenter(EHitBox.HEAD)
local _, pen = mods.penetration.FireBullet(eye_position, enemy_position - eye_position,
weapon, enemy)
print(pen.damage, pen.hitgroup)damage
number
The damage to be scaled
weapon
number
The scaled damage
local weapon = local_player:GetActiveWeapon()
local dmg = mods.penetration.ScaleDamage(45, weapon, HitGroup_t.HEAD, enemy)weapon
The gun the bullet is being fired from
target
The target player, can be nil
clamp
boolean
Whether or not to clamp the tracing to the player.
The gun the bullet is being fired from
hitgroup
The desired hitgroup.
target
The target player
Type
Description
name
string
Field name.
Type
Description
Accessor instance.
local price = wpn_data.m_nPrice;
local price = wpn_data['m_nPrice']; -- this also worksFatality’s API is designed to mirror the software’s internal structure, giving you substantial control over its subsystems. Some features that could cause instability or damage are restricted.
Our scripting engine uses LuaJIT 2.1 (with minor customizations). It’s fully compatible with Lua 5.1 and includes some Lua 5.2 enhancements.
The standard libraries baselib, bit, ffi, math, string and table are available. Note that the ffi library is only available if the Allow insecure option is enabled. Refer to for more details.
If we ever modify any standard functions, we will document those changes to keep you informed.
Throughout the API reference, you’ll encounter various labels used to describe a certain method or a field.
Field Function Method Constructor Read only Insecure only Overridable
All the possible labels are listed above.
Field: this label indicates that the item is a standard field. It's type will be explained just below the name.
Function: this label indicates that the item is a function, which you call using a dot syntax (obj.fn()).
Arguments and return values are listed in the exact order you must supply or capture them. For instance, if a parameter is shown first, it is to be passed as the first argument to the function. The same goes for return values: the first listed value will be placed in the first variable you declare, and so on.
Some type descriptions have special symbols in place:
type? means that the type might be nil.
type<other> means that inner methods or fields will use other type.
<other>
To keep your scripts safe and easy to use, we have quite a lot of safety measures in place. But, due to how specific stuff works, we are unable to fully make it as safe as possible. Therefore, here are some notes you should know before writing scripts:
You may replace or override API functions, but you’re responsible for maintaining stable behavior. If you encounter any bugs in the default API (excluding FFI), please report them so we can address the issue.
Using FFI grants you extensive freedom. Keep in mind that scripts which could harm users in any way are disallowed and will be removed. Whenever possible, rely on the provided API or request additional functionality if you need something not currently offered. Custom “script loaders” are strictly disallowed.
Avoid hiding unrelated UI elements, obstructing user input, or interfering with the overall user experience. Scripts that disrupt functionality or harass users risk removal from the Workshop.
In this tutorial you’ll create and publish a script to the Storefront. The same flow applies to Libraries and Configs.
Go to Workshop -> Manage Items and click Create new item.
Fill out:
Title
Game (the supported title your script targets)
Method: this label indicates that the item is a method, which is also a function, but it's advised to call it with the colon syntax (obj:fn()).Constructor: this label indicates that the item is a constructor definition. You don't have to call any field in particular, but instead you must invoke the type itself (example: vector has __call, meaning you should invoke it like this: vector()).
Read Only: this label indicates that the item is read only, and it's value cannot be changed. Typically, this restriction does not extend to any child elements.
Insecure only: this label indicates that the item is only available if the insecure mode is turned on.
Overridable: this label indicates that the method, can be overridden by the developer and its parent type will inherit any functionalities.
otherItem type (Script / Library / Config)
Open the Builds tab and click Upload new build.
Fill out:
Version (use semantic versioning like 1.0.0 if possible)
Changelog (short, factual)
File upload (your .lua file or a .zip)
Click Save. The build is created in the Draft state.
Click Submit for review. The build state changes to Under review.
After moderation approves it, you’ll get a notification and the state changes to Approved.
Click Set to branch and choose Default.
This makes the approved build the version users receive when they add your script to their library.
If your script needs restricted APIs (e.g. FFI, filesystem, clipboard), enable the required Capabilities so users can grant permission.
In Builds -> Capabilities (right side), select only what you need and click Save.
Open the General tab and complete all fields in the Release Checklist.
When the checklist is complete, click Submit for review on the item. After moderation approves it, the item is automatically published on the Storefront and users can purchase or subscribe.
Warning: You cannot change the item type later.






This type represents a CBaseAnimGraph class.
Type
Description
Weapon ID.
local wep_id = wep:GetDefIndex();Type
Description
Weapon type.
local type = wep:GetType();Type
Description
Weapon data.
local data = wep:GetData();This type represents a texture object.
Constructor
Constructs an instance of this type.
Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.
Arguments
1. From file.
Name
2. From memory.
3. From RGBA data.
Returns
Example
FieldRead only
Type: bool
Set to true if this is an instance of .
Method
Returns size of this texture.
Arguments
None.
Returns
Example
This enum is used to determine the outline mode for outlined shapes.
Field
Inset outlining. This means that the outline will be inside the shape (+1px from top-left, -1px from bottom-right).
Field
Outset outlining. This means that the outline will be outside of the shape (-1px from top-left, +1px from bottom-right).
Field
Center outlining. This means that the outline will match the shape size.
h
int
Height (row count).
p
int
Pitch (row width). This is the amount of bytes per row.
TGA (.tga)
BMP (.bmp) - 1 bpp and RLE variants are not supported.
PSD (.psd) - composited view only, no extra channels, 8/16 bpc
GIF (.gif) - only first frame, for animated gifs use AnimatedTexture
HDR (.hdr)
PIC (.pic)
PNM (.pnm, .ppm, .pgm) - PPM and PGM are binary only
Type
Description
path
string
Path to a valid texture file.
Name
Type
Description
data
Pointer to texture file data in memory.
sz
int
Name
Type
Description
data
Pointer to RGBA data in memory.
w
int
Type
Description
texture
Texture object.
Type
Description
Texture dimensions.
Size of the texture file data.
Width.
local tex = draw.Texture('funny_meme.png');local sz = tex:GetSize();Now that you’ve covered the essentials, it’s time to start scripting.
Feel free to use any text editor you prefer: , , or even a simple Notepad.
Local scripts are located here: <CS2_Directory>/game/csgo/fatality/scripts. You may notice there's also a lib directory, but we’ll get to that later.
Create a new file ending with .lua, and begin your work on the script.
A typical “Hello world!” example can be a bit trivial, so let’s try something slightly more advanced instead.
Now, let's break down this example script:
Most of your scripting will run within we provide. Each event has its own signature, so pay attention to the parameters your callback function should accept.
Now that you know the basics, let’s extend our script by allowing the user to toggle the text. We can do this by adding a control to the menu.
Let’s start by creating a simple checkbox:
Each control has a unique ID, which the UI framework uses to distinguish controls within containers. It’s very important that your control’s ID doesn’t conflict with others, as that could result in a broken state or worse.
To create the ID, call gui.ControlID and pass the desired ID, or just pass a simple string instead.
Then, create the checkbox by calling gui.Checkbox and passing the ID you've chosen.
By default, controls are typically placed in rows - layouts that stack elements in a specific manner. We provide a simple helper function - gui.MakeControl.
You may also create both the control and the checkbox, or any other menu element, at the same time using
Libraries are specialized items that are not visible in the Storefront. Instead, they are available for other publishers to reference inside their scripts.
Creating a library works the same way as creating a script (see).
The only difference is that a library requires a Library ID.
The Library ID is a unique identifier used by scripts to reference your library.
Without it, other publishers cannot include your library as a dependency.
You can create and assign a Library ID in the
This type represents a grenade projectile.
Method
Returns the grenade type.
Arguments
None.
Returns
Encapsulates the plane information in the trace object.
FieldRead only
Type:
FieldRead only
Type:
This enum represents the firing mode for a weapon.
Field
Primary mode (usually left mouse button).
Field
Secondary mode (usually right mouse button).
Libraries allow users to write pre-written, reusable code that can be imported anywhere, at any time. This is useful if you often reuse portions of your code in multiple scripts, or if you wish to compartmentalize your scripts and have a cleaner code base.
In Fatality, libraries are divided into two categories: Local libraries and Cloud libraries. Local libraries are located in your fatality/scripts/lib folder and may only be used by other local scripts, meanwhile cloud libraries are similar to cloud scripts and can be shared and imported by any other cloud script through the workshop. Despite that difference, libraries follow the same code structure:
You may then import said library from another file using either its file name or identifier.
If you want to include additional files with your script (e.g. sounds, images, or data), you can bundle them inside a ZIP archive with a defined structure.
The archive must contain a script.lua file in the root.
The archive must not contain a scripts/remote/ directory or any files inside it.
All bundled assets are automatically installed to a directory chosen by the API engine. See ws for usage details.
Name
Type
Description
name
string
Var name.
Type
Description
Convar object.
-- Usually, a 'module' table is created and all of your libraries contents go into it.
local M = {}
-- You can export functions.
function M.MyFunction()
print('Call from my library')
end
-- Or constants.
M.MyValue = 979
-- Or any other value.
M.MenuElement = gui.Checkbox('external_checkbox')
-- At the end of every library, make sure to return the contents you wanna export!
return M-- In another file.
local my_library = require('library')
my_library.MyFunction() -- Prints 'Call from my library'
print(my_library.MyValue) -- Prints '979'
gui.ctx:Find('lua>elements a'):Add(my_library.MenuElement) -- Adds a new checkboxDescription
int
Grenade type.
Example
Type
local type = gren:GetGrenadeType();local sv_quantize_movement_input = game.cvar:Find('sv_quantize_movement_input')
if not sv_quantize_movement_input then
error('sv_quantize_movement_input not found')
endpresentQueueWith the callback function defined, let’s actually render something on the screen!
To do this, you first need to access the drawing layer. We provide a single drawing layer that’s safe to use within the game thread. Due to how the game functions internally, it’s strongly discouraged to call game functions in other threads. Luckily all of our events run in the game thread.
This setup allows you not only to draw but also to query information on player health or other entities.
To access the layer, simply reference the surface field in the draw table:
After retrieving the layer, you must set a font object before drawing any text on the screen. This is purely for performance reasons, so you don’t have to pass a heavy font object every time you draw text.
All fonts are stored in draw.fonts. To access a font, either use dot syntax, or treat it like a dictionary:
With the font set, it’s time to draw some text.
Invoke the AddText method on the layer. Notice that it’s called using the colon syntax: obj:fn(), because it’s a method.
Now that you’ve created your first callback, you need to register it so Fatality knows to invoke it. This is done by calling the Add method on events.presentQueue.
That's it! If you've done everything correctly, you should see something like this:
local function onPresentQueue()
local d = draw.surface;
d.font = draw.fonts['gui_main'];
d:AddText(draw.Vec2(50, 50),
'Hello drawing! My first script speaking.',
draw.Color.White()
);
end
events.presentQueue:Add(onPresentQueue);local function onPresentQueue()
endlocal d = draw.surface;d.font = draw.fonts['gui_main'];d:AddText(draw.Vec2(50, 50),
'Hello drawing! My first script speaking brev.',
draw.Color.White()
);events.presentQueue:add(onPresentQueue);gui.MakeControlEasyWith the control and row ready, let’s add them to a group.
In this example, we'll use the lua>elements a group. First, locate that group in the global context:
Then call its Add method to include your row:
That's it!
Next, let’s modify our previous script so the text only appears if the checkbox is checked. Wrap your drawing code in an if statement before rendering the text:
and close it after.
The final script should look something like this:
And here's the result:
local cb = gui.Checkbox('my_checkbox');local row = gui.MakeControl('My checkbox', cb);local cb, row = gui.MakeControlEasy('my_checkbox', 'My checkbox', 'checkbox')local group = gui.ctx:Find('lua>elements a');group:Add(row);if cb:GetValue():Get() thenlocal cb, row = gui.MakeControlEasy('my_checkbox', 'Checkbox', 'checkbox');
local group = gui.ctx:Find('lua>elements a');
group:Add(row);
local function onPresentQueue()
if cb:GetValue():Get() then
local d = draw.surface;
d.font = draw.fonts['gui_main'];
d:AddText(draw.Vec2(50, 50),
'Hello drawing! My first script speaking.',
draw.color.White()
);
end
end
events.presentQueue:Add(onPresentQueue);Once published and approved, your library becomes available for others to use as a dependency.
When your script references a library, the library is automatically loaded alongside your script at runtime.
To add a library dependency:
Go to the Dependencies tab.
Click Add dependency.
Find the library you want to reference and click Add.
The library will appear in your dependencies list.
It is recommended to reference a specific version of a library rather than always pulling the latest. This ensures your script continues to work even if the library author publishes breaking changes later.
This type encapsulates all penetration data returned from FireBullet.
Field
The damage done by the weapon.
Field
The hitgroup that was hit. May be invalid.
Method
Returns one of the bullet impacts.
Arguments
Returns
Example
Method
Returns how many bullet impacts there is.
Arguments
None.
Returns
Example
This enum is used to determine shadow direction for add_shadow_line method.
Field
The darkest side of the shadow will be at the bottom.
Field
The darkest side of the shadow will be at the top.
Field
The darkest side of the shadow will be on the left side.
Field
The darkest side of the shadow will be on the right side.
An instance of this type provides a way to interface with Source 2's Engine-to-Client service.
Method
Returns last timestamp, in seconds.
Arguments
This type is an animated texture. This texture type only supports animated GIF types, and does not support APNG.
Constructor
Constructs animated texture.
Arguments
1. From file.
This enum represents the observer modes available in the game.
Field
Represents no observer mode (not spectating anyone).
Field
Represents a fixed camera position.
Describes the ray type used by the tracing methods.
Method
Changes the shape of the ray to a box/hull, using the specified mins and maxs.
Arguments
In this section, the most common renderer types are listed, that are not particularly bound to a specific part of the renderer.
This type represents the game's UI functions.
Method
Returns the binding name for a button code.
Arguments
This type represents the game's control input system.
Method
Converts a virtual key to button code.
Arguments
This table exposes several mods (short for Module, not Modification), that Fatality uses to operate.
Field
Type:
Event manager. Use this mod if you want to listen to more in-game events.
This enum is used to toggle rendering modes.
Field
Normal, opaque rendering. All polygons will get filled with color, and texture sampling will be fully supported. This is the default mode to render shapes in layer.
Field
Wireframe rendering. This means that the polygons will no longer be filled with color, nor texture sampling will ever work.



Represents observing from the perspective of the player being spectated.
Field
Represents a chase camera that follows the player being spectated.
Field
Represents a free-roaming camera.
Field
Represents an automatically directed camera, typically controlled by the game or server.
index
number
The hit position index
The bullet impact, nil if index >= GetHitPosCount() .
number
The bullet impact count
code
int
Button code.
Returns
string
Binding.
Example
vk
int
Virtual key.
Returns
int
Button code.
Example
local positions = {}
for i = 1, pen_result:GetHitPosCount() do
positions[i] = pen_result:GetHitPos(i - 1)
endlocal amount = pen_result:GetHitPosCount()local bind = game.gameUIFuncs:GetBindingForButtonCode(code);local button = game.input_system:VKToButtonCode(0x41); -- 'A'Returns
float
Timestamp, in seconds.
Example
Method
Returns last server tick number.
Arguments
None.
Returns
int
Server tick number.
Example
Method
Returns whether the client is currently in game.
Arguments
None.
Returns
bool
In-game status.
Example
Method
Returns whether the client is currently connected to a game server.
Arguments
None.
Returns
bool
true if connected.
Example
Method
Returns the Network Channel used for network communication.
Arguments
None.
Returns
Network channel, or nil if does not exist.
Example
Method
Executes a client-sided console command.
Arguments
cmd
string
Command to execute.
bool
unrestricted
Returns
Nothing.
Example
Method
Returns client window screen size.
Arguments
None.
Returns
int
Width.
int
Height.
Example
local last_time = game.engine:GetLastTimestamp();local server_tick = game.engine:GetLastServerTick();if game.engine:InGame() then
print("I'm in game!");
endif game.engine:IsConnected() then
print("I'm connected!");
endlocal chan = game.engine:GetNetChan();game.engine:ClientCmd('say Hello!');local w, h = game.engine:GetScreenSize();Description
path
string
Path to the texture file.
2. From memory.
Name
Type
Description
data
Pointer to texture file data in memory.
sz
int
Returns
Type
Description
animated_texture
Animated texture instance.
Example
Field
Type: bool
If set to false, will not loop the animation automatically. Defaults to true.
Method
Reset loop to run from the first frame.
Arguments
None.
Returns
Nothing.
Example
Method
Set a specific frame on the animation. If looping is enabled, will continue the cycle from the passed frame. Otherwise, will display a specific frame of the animation.
Arguments
Name
Type
Description
frame
int
Frame number. Invalid frame numbers will be clamped.
Returns
Nothing.
Example
Method
Returns amount of frames in the animation.
Arguments
None.
Returns
Type
Description
int
Frame count.
Example
Name
If you pass an unsupported type, it will instead work exactly like Texture type, meaning controlling frames and looping will be meaningless.
Using this type for texture atlases is possible, although highly unrecommended. It will produce extra texture objects in memory, and overall will be much slower. Instead, it is advised to construct an actual texture atlas, use Texture type, and use texture mapping.
Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.
Type
local gif = draw.AnimatedTexture('funny_gif.gif');gif:ResetLoop();gif:SetFrame(5);local frames = gif:GetFrameCount();
gif:SetFrame(frames - 2); -- set to the last framemins
The minimum bounding of the box
maxs
The maximum bounding of the box
Returns
Nothing.
Example
Method
Changes the shape of the ray to a sphere, using the specified center position and radius.
Arguments
Name
Type
Description
center
The center of the sphere
radius
number
Returns
Nothing.
Example
Name
Type
Description
local ray = Ray_t()
ray:SetHull(Vector(-4, -4, -4), Vector(4, 4, 4)) -- Traces a cube (8x8x8).local ray = Ray_t()
ray:SetSphere(Vector(0, 0, 0), 10) -- Traces a sphere.This enum is used to determine which parts of the glow around the shape should get rendered.
Field
Draw top-left corner.
Field
Draw top-right corner.
Field
Draw bottom-left corner.
Field
Draw bottom-right corner.
Field
Draw top line.
Field
Draw left line.
Field
Draw right line.
Field
Draw bottom line.
Field
Draw all the left side shapes. This includes both left corners and the line.
Field
Draw all the right side shapes. This includes both right corners and the line.
Field
Draw all the top side shapes. This includes both top corners and the line.
Field
Draw all the bottom side shapes. This includes both bottom corners and the line.
Field
Draw the entire glow around the shape.
Field
Draw glow except for the bottom line.
Field
Draw glow except for the top line.
Field
Draw glow except for the right line.
Field
Draw glow except for the left line.
This enum determines how to align the text when drawing it.
Field
Align left. It will mean that the text position's X coordinate is located at the left side of the text area.
Field
Align center. It will mean that the text position's X (or Y) coordinate is located at the center of the text area.
Field
Align right. It will mean that the text position's X coordinate is located at the right side of the text area.
Field
Align top. It will mean that the text position's Y coordinate is located at the top side of the text area.
Field
Align bottom. It will mean that the text position's Y coordinate is located at the bottom side of the text area.
This enum represents the category classification for weapons in the game.
Field
Represents weapons or items that don't fit into any specific category.
Field
Represents melee weapons, such as knives or other close-combat tools.
Field
Represents secondary weapons, such as pistols.
Field
Represents submachine guns (SMGs).
Field
Represents rifles, including assault rifles and sniper rifles.
Field
Represents heavy weapons, such as machine guns and shotguns.

Below is a list of all global functions. By “global”, we mean these functions do not require a preceding namespace - so you can call them directly, unlike other functions.
Function
Prints text to game's console. Automatically inserts a space between parameters.
This type represents a control ID.
Constructor
Constructs the ID structure.
Arguments
This type represents the game's command input system.
FieldRead only
Type: bool
Firing mode information.
FieldRead only
Type: <type>
Values.
Welcome to the Publishing Tool documentation.
Creating a script:
Using branches:
Using libraries:
Whether should the execution preserve any restrictions. Defaults to false.
Size of the texture file data.
The radius of the sphere
Description
sv
string
SVG text.
h
float
Target height. Defaults to 0, and 0 means that there will be no automatic downscale.
Type
Description
SvgTexture
SVG texture object.
Description
notif
Notification object.
notif:Add(my_notification);id
string
ID.
Returns
Type
Description
ControlID
ID structure.
Example
FieldRead only
Type: int
Hashed representation of the ID.
FieldRead only
Type: string
Normal representation of the ID.
Name
Type
Description
local lightning = draw.SvgTexture([[
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.55563 13.3232L9.43584 13.3123C7.90803 13.1735 7.14412 13.104 6.90146 12.5814C6.65881 12.0588 7.09869 11.4304 7.97846 10.1736L11.5612 5.05544C12.1424 4.22517 12.433 3.81003 12.6836 3.89831C12.9342 3.98658 12.9005 4.4922 12.8331 5.50343L12.6299 8.55194C12.5685 9.47214 12.5379 9.93224 12.8023 10.2419C13.0667 10.5515 13.5259 10.5933 14.4444 10.6768L14.5642 10.6877C16.092 10.8265 16.8559 10.896 17.0985 11.4186C17.3412 11.9412 16.9013 12.5696 16.0215 13.8264L12.4388 18.9446C11.8576 19.7748 11.567 20.19 11.3164 20.1017C11.0658 20.0134 11.0995 19.5078 11.1669 18.4966L11.3701 15.4481C11.4315 14.5279 11.4621 14.0678 11.1977 13.7581C10.9333 13.4485 10.4741 13.4067 9.55563 13.3232Z" fill="#ffffff"/>
<path d="M18.5 4L17 6H19L17.5 8" stroke="#ffffff" stroke-opacity="0.6" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6.5 16L5 18H7L5.5 20" stroke="#ffffff" stroke-opacity="0.6" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
]], 24);local cb = gui.Checkbox('my_checkbox_id') -- Auto converts into ControlIDlocal id = gui.ControlID('my_id');...
Values to print in the console.
Example
Function
Prints an error text to game's console, and shuts down the script. Try to avoid using this function - use it only if an error happens which you can't recover from.
text
string
Read for documentation.
Example
Function
Unpacks a table of elements.
tbl
table
Any table
Example
Function
Delays a callback by a certain amount of time, in seconds.
delay
number
Delay, in seconds
callback
function
Example
Function
Special function, it's called whenever the script unloads. Isn't called in case of errors.
None.
Example
...
print('Hello world!', 123); -- prints out "Hello world! 123" to the consoleerror('Can't recover from this one! Error: ' .. tostring(123));local message = { 'Hello', 'World' }
print(unpack(message)) -- 'Hello world'Delay(0.5, function()
print('Print after 0.5 seconds')
end)function __shutdown()
print('Script was unloaded successfully.')
endtrue if currently in third person from the game.
FieldRead only
Type: bool
true if third person is currently being simulated.
Method
Returns current camera view angles.
Arguments
None.
Returns
View angles.
Example
Method
Sets new camera view angles.
Arguments
ang
View angles.
Returns
Nothing.
Example
local ang = game.input:GetViewAngles();game.input:SetViewAngles(math.Vec3(0, 0, 0));In our Lua API, we give users the ability to make their own custom menu controls. Here's an example on how to make a simple counter:
local Counter = {} do
-- Create the metatable for this control.
Counter.__index = gui.LuaControlProto()
-- Specify any initial data. This is propagated to any LuaControl initialized with this metatable.
Counter.__index.initialData = {
counter = 0
}
-- Override any methods you wish.
function Counter.__index:onRender(contents, scrollbar, mins, maxs)
contents:AddRectFilled(draw.Rect(mins, maxs), draw.color.White())
contents.font = draw.fonts['gui_bold']
contents:AddText(mins + draw.Vec2(5, 5), tostring(self.data.counter), draw.color.Black())
contents.font = nil
end
function Counter.__index:onMouseDown(key)
if key == gui.MouseButton.LEFT then
self.data.counter = self.data.counter + 1
self:LockInput() -- Makes sure you can't drag the menu while clicking.
end
end
function Counter.__index:onMouseUp(key)
if key == gui.MouseButton.LEFT then
self:UnlockInput() -- Makes sure you can drag menu again after clicking.
end
end
function Counter.create(id, initialValue)
local control = gui.LuaControl(id, Counter.__index, draw.Vec2(), draw.Vec2(0, 24)) do
control.sizeToParentW = true -- Resizes the control to the width of the container.
control.data.counter = initialValue or 0
control.margin = draw.Rect(3, 7, 3, 7) -- Default control margin
end
return control
end
end
gui.ctx:find('lua>elements a'):add(Counter.create('counter'))With that, you'll have an extremely simple counter that you can click on to increment.
This type represents a special structure that references a certain field in the entity object.
Field
Type: number
Method
Returns the value.
Arguments
Last modified: 03 January 2025
This type represents a safe way to access maps.
Function
Returns an object by key.
Arguments
This type represents a rendering adapter used within the rendering system.
Method
Returns a back buffer texture. May return a blank or outdated texture, if the back buffer texture was not updated.
Arguments
None.
Returns
This type represents an entity list.
Method
Loops the entities.
Arguments
Callback
Type
Description
name
string
System font name (example: 'Arial').
size
float
Font height, in pixels.
fl
Font flags. Use bit library to construct them. Defaults to 0.
mi
int
Starting codepoint. Defaults to 0.
ma
int
Ending codepoint. Defaults to 255 (entire ASCII code page).
weight
int
Font weight. Defaults to 400 (regular).
Type
Description
FontGDI
Font object.
local sys_font = draw.FontGDI('Calibri', 14);Returns
Type
Description
<type>
Value.
Example
Method
Returns the value casted as another game class. Automatically dereferences pointers.
Arguments
Name
Type
Description
module
string
The name of the module
class
string
Returns
Type
Description
<type>
Casted value.
Example
Method
Sets the value.
Arguments
Name
Type
Description
value
<type>
Value.
Returns
Nothing.
Example
Do not ever store an instance of this type anywhere but in a scope of an event because entity might be removed.
local health = player.m_iHealth:Get();local collision = player.m_pCollision:GetAs('client.dll', 'CCollisionProperty');
local mins = collision.m_vecMins:Get()
local maxs = collision.m_vecMaxs:Get()player.m_iHealth:Set(50); -- won't really do anything with the healthDescription
key
string
Object key.
Returns
Type
Description
<type>
Object.
Example
Function
Sets an object by key.
Arguments
Name
Type
Description
key
string
Object key.
obj
<type>
Returns
Nothing.
Example
Name
Type
local main_font = draw.fonts['gui_main'];
-- this also works
local main_font_2 = draw.fonts.gui_main;draw.fonts['my_font'] = my_font;
-- this also works
draw.fonts.my_font = my_font;Type
Description
Back buffer texture pointer.
Example
Method
Returns a 4x down sampled version of the back buffer texture.
Arguments
None.
Returns
Type
Description
Downsampled back buffer texture pointer.
Example
Method
Returns a shared texture. This texture usually replicates the down sampled back buffer texture, although it is updated automatically ONCE before the rendering on the layer starts.
Arguments
None.
Returns
Type
Description
Shared texture pointer.
Example
local bb = adapter:GetBackBuffer();local ds = adapter:GetBackBufferDownsampled();local shared = adapter:GetSharedTexture();fn
function()
Function callback.
Returns
Nothing.
Example
Method
Loops the entities in the reverse order.
Arguments
Name
Type
Description
fn
function()
Function callback.
Returns
Nothing.
Example
Name
Type
Never save any entities you get from this list if you don't know what you are doing! You may be left with dangling pointers, which will inevitably lead to a crash.
Description
entities.players:ForEach(function (entry)
-- ...
end);entities.players:ForEachZ(function (entry)
-- ...
end);Represents a particle instance created by game.CreateParticle.
Method
Returns true if the particle is still valid.
Arguments
None.
Returns
Example
Method
Expires the particle immediately.
Arguments
None.
Returns
Nothing.
Example
Method
Sets a control point.
Arguments
Returns
Nothing.
Example
Method
Initializes the particle snapshot positions.
Arguments
Returns
Nothing.
Example
Method
Sets an entity attachment for a control point.
Arguments
Returns
Nothing.
Example
Field
Type: number
The remaining particle lifetime in seconds.
You can read or write this value.
This table represents an internal entity list.
Never store any entities in the global scope! Any entity might get deleted, and you will no longer have a valid instance of that entity, which will inevitably lead to a crash. If you need to globally store an entity somewhere, we strongly recommend you store an instance of , and use it's method to retrieve the entity again, when needed.
Field
Type: EntityList_t<C_CSPlayerPawn>
Player pawns.
Field
Type: <>
Player controllers.
Field
Type: <>
Items (held).
Field
Type: <>
Dropped items.
Field
Type: <>
Grenade projectiles.
Function
Returns the local player's pawn.
Arguments
None.
Returns
Example
Function
Returns the local player's controller.
Arguments
None.
Returns
Example
Last modified: 03 January 2025
This enum is used to determine the rounding for rounded shapes.
Field
Round top-left corner.
Field
Round top-right corner.
Field
Round bottom-left corner.
Field
Round bottom-right corner.
Field
Round both of the top corners. This produces the same result as using bit.bor(draw.Rounding.TL, draw.Rounding.TR).
Field
Round both of the left corners. This produces the same result as using bit.bor(draw.Rounding.TL, draw.Rounding.BL).
Field
Round both of the right corners. This produces the same result as using bit.bor(draw.Rounding.TR, draw.Rounding.BR).
Field
Round both of the bottom corners. This produces the same result as using bit.bor(draw.Rounding.BL, draw.Rounding.BR).
Field
Round all corners. This produces the same result as using bit.bor(draw.Rounding.TL, draw.Rounding.TR, draw.Rounding.BL, draw.Rounding.BR).
Workshop allows you to publish, advertise, and earn from your items. It provides a broad set of features for both publishers and end users, making the storefront easy to use and reliable to manage.
Before publishing, it's important to understand the key concepts used in Workshop:
Storefront - the main Workshop UI where users search, view, subscribe to, or purchase items;
Publishing Tool - the area where item authors create, update, and manage their entries in the storefront;
Item - a single Workshop entry. This can be a script, a library, or a config;
Build - a specific version of an item that gets delivered to the end user;
Branch - a channel that holds a single build (e.g. stable, beta);
Dependency - a required library that an item relies on to function;
Capability - a permission that unlocks restricted API functions (e.g. filesystem access, clipboard).
Read the .
Complete a tutorial.
This type represents a font object. Internally, this type uses FreeType library to rasterize font glyphs.
Constructor
Constructs a font object.
Arguments
1. From file.
This enum represents the weapon type in the game.
Field
Represents a knife-type weapon.
Field
Represents a pistol-type weapon.
This module lets you manage custom in-game event listener.
Method
Adds a game event to the listener.
Arguments
Defines a custom filter for TraceRay.
Field
Type: boolean
Ignores all player entities when true.
Field
Type: boolean
Represents an entity entry.
Field
Type: <type>
Entity instance. Type depends on the list you get it from.
Field
Type:
The name of the class
Object.
Represents a submachine gun-type weapon.
Field
Represents a rifle-type weapon.
Field
Represents a shotgun-type weapon.
Field
Represents a sniper rifle-type weapon.
Field
Represents a machine gun-type weapon.
Field
Represents a C4 explosive.
Field
Represents a taser weapon.
Field
Represents a grenade-type weapon.
Field
Represents a stackable item-type weapon.
Field
Represents fists as a weapon type.
Field
Represents a breach charge-type weapon.
Field
Represents a bump mine-type weapon.
Field
Represents a tablet-type weapon.
Field
Represents a melee-type weapon.
Field
Represents a shield-type weapon.
Field
Represents a zone repulsor-type weapon.
Field
Represents an unknown weapon type.
booltrue if the client had received any updates to this entity at least once.
Field
Type: CHandle
Entity's handle. You may store this elsewhere if you need to have global access to an entity.
Field
Type: Texture
Player's profile picture. Will be nil if was yet to be initialized.
Field
Type: PlayerEntryVisualData
Player's ESP information.
This field is only available on entries that use C_CSPlayerController type.
This field is only available on entries that use C_CSPlayerPawn type. Use only inside the playerInfoPre and playerInfoPost callbacks, otherwise you may access outdated or invalid data.
Type
Description
Pawn.
Type
Description
Controller.
name
string
Event name.
Returns
Nothing.
Example
Please note that the game server knows which events you are listening to. Internally, we only listen to events that will get sent to the client anyway in one way or another. If you decide to listen to something the server generally does not expect, it may cause issues on official servers.
Internally we listen to the following events:
bullet_impact
weapon_fire
bomb_beginplant
bomb_abortplant
bomb_planted
bomb_defused
bomb_exploded
round_start
game_newmap
map_shutdown
Adding those events to the listener is not needed.
Ignores all game entities except players when true.
Field
Type: boolean
Ignores world collisions when true.
Field
Type: C_BaseEntity*
Overrides ignorePlayers and ignoreEntities when set.
The trace can only hit this entity and the world if ignoreWorld is false.
Field
Type: C_BaseEntity*
Ignores this entity.
Field
Type: C_BaseEntity*
Ignores this entity.
local lp = entities.GetLocalPawn();local lp_ctrl = entities.GetLocalController();mods.events:AddListener('round_end');local filter = LuaTraceFilter_t()
filter.ignoreWorld = true
filter.ignoreEntity = entities.GetLocalPawn()attachment
Attachment mode.
name
string?
Optional attachment point name.
bool
true if valid.
if particle:IsValid() then
-- ...
endparticle:Destroy()index
number
Control point index.
value
particle:SetControl(0, Vector(0, 0, 0))positions
table<Vector>
Snapshot positions.
particle:Initialize({
Vector(0, 0, 0),
Vector(50, 50, 50),
})index
number
Control point index.
ent
particle:SetEntity(0, ent, ParticleAttachment_t.ABSORIGIN_FOLLOW)Control point value.
Entity to attach to.
Type
Description
path
string
Path to a ttf/otf file.
size
float
Font height, in pixels.
fl
Font flags. Use bit library to construct them. Defaults to 0.
mi
int
Starting codepoint. Defaults to 0.
ma
int
Ending codepoint. Defaults to 255 (entire ASCII code page).
1. From memory.
Name
Type
Description
mem
Pointer to a font file in memory.
sz
1. From memory, with codepoint pairs.
Name
Type
Description
mem
Pointer to a font file in memory.
sz
int
Returns
Type
Description
Font
Font object.
Example
Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.
Name
local cool_font = draw.Font('myfont.ttf', 16);This table exposes various internal services and global objects used by Fatality, and also provides a way to retrieve any additional services you need.
Field
Type: CGlobalVarsBase
This service exposes global variables used by the game, such as frame time or current server time.
Field
Type: CEngineClient
This service exposes the engine client, which includes commonly used engine-related functions.
Field
Type: CCSGOInput
This service exposes the command input system.
Field
Type: CInputSystem
This service exposes the control input system.
Field
Type: CGameUIFuncs
This service exposes the game's UI functions.
Field
Type: CPhysicsQueryInterface
This service exposes the game's tracing functions.
Field
Type: CGameEntitySystem
This service exposes some of the game's entity list functions.
Method
Plays a game sound.
Arguments
Returns
Nothing.
Example
Method
Creates a particle effect.
attachment and owner are optional.
Arguments
Returns
Example
Provides a way to interface with a Network Channel's class.
Method
If the current channel is null, this function will return nil instead.
Returns address string of the remote machine.
Arguments
None.
Returns
Type
Example
Method
Returns whether the current channel is connected to the local machine (loopback address).
Arguments
None.
Returns
Example
Method
Returns whether the channel is stubbed.
Arguments
None.
Returns
Example
Method
Returns current latency to the remote server (in seconds).
Arguments
None.
Returns
Example
This type represents an entity handle.
Field
Type: number
Method
Returns the entity, or nil if nothing found.
Arguments
None.
Returns
Example
Method
Returns true if the handle is valid.
Arguments
None.
Returns
Example
Method
Returns true if the handle links to a client-side entity.
Arguments
None.
Returns
Example
This type represents a managed object. You cannot create an instance of this type directly.
Every object, that inherits from this type, must be Created before use. The rendering system will only create them automatically, if you happen to lose a device object (e.g. minimize the game window, and then restore it) and only if you add your objects to manage table in draw.
FieldRead only
Type: Ptr
Pointer to a GPU object. If this object is not created, this field will be nil. You can use the value of this field to pass it to directly for example, or if you (for whatever reason we don't recommend you doing) want to have a direct control over the pointer - cast it to FFI's cdata.
Method
Creates a managed object in GPU memory.
Arguments
None.
Returns
Nothing.
Example
Method
Destroys a managed object in GPU memory.
Arguments
None.
Returns
Nothing.
Example
Branches let you create separate versions of your items so users can test upcoming builds before they are pushed to the live Default branch.
Open the Branches tab to manage existing branches or create new ones:
Click Add branch, enter a branch title, and confirm.
You can create as many branches as you need.
After a branch is created, you can:
Add users (they’ll be allowed to opt in).
Set a price (makes the branch public so anyone can purchase it).
Branches can hold any builds - both verified and unverified.
To assign a build to a branch:
Go to the Builds tab.
Find the build you want to assign.
Click Set branch.
Select the branch and submit.
This immediately makes that build available to anyone using the branch.
This type represents a CCSWeaponBaseGun class.
Method
Returns the maximal player speed when holding this weapon.
Arguments
None.
Returns
Usage:
This type encapsulates all tracing functionalities.
Function
This type represents a shader.
The constant buffer fields are the following:
Usage:
game.globalVars.{field}
An instance of this type provides a way to read several global variables that are used by the game. Changing any of the values is not and will never be supported.
int
Font file size, in bytes.
size
float
Font height, in pixels.
fl
Font flags. Use bit library to construct them. Defaults to 0.
mi
int
Starting codepoint. Defaults to 0.
ma
int
Ending codepoint. Defaults to 255 (entire ASCII code page).
Font file size, in bytes.
size
float
Font height, in pixels.
fl
Font flags. Use bit library to construct them. Defaults to 0.
pairs
table[{int, int}...]
Min/max pairs. This is a standard array, consisting of {int, int} pairs.
Note: Adding users does not automatically enable the branch for them. It only gives them the option to join.



Type: float
Time passed since the game start, in seconds.
Field
Type: int
Amount of frames rendered since the game start.
Field
Type: float
Absolute (averaged) frame time. It is calculated over a set of previous frame times, and should not be used for anything that requires accurate frame time like animation.
Field
Type: int
Maximum amount of clients on the current server.
Field
Type: int
Amount of ticks passed during the currently rendered frame. Any value above 1 might indicate a stall during rendering.
Field
Type: float
Time, in which a previous frame was rendered. May be used for animation or by any other means that require accurate frame time.
Field
Type: float
Time passed since the server's game start. This does not indicate the accurate time on the server, although in several events it might be synced by the software.
Field
Type: float
Current tick's fractional value.
Field
Type: int
Ticks passed since the server's game start.
Field
Type: string
Relative path to current loaded map's file.
Field
Type: string
Name of the currently loaded map.
Description
string?
IP-address or Steam Server Address.
Type
Description
bool?
true if connected to the local machine.
Type
Description
bool
true if current channel is a dummy channel.
Type
Description
float?
Latency (in seconds).
If the current channel is null, this function will return nil instead.
If the current channel is null, this function will return nil instead.
Type
Description
<type>
Entity instance.
Type
Description
bool
true if valid.
Type
Description
bool
true if client-sided.
You should Create() an object only once. Invoking this method after the object was created will be meaningless.
Never destroy a GPU object if it is being used in rendering (for example, when you have pushed some shape that uses a texture, and then destroyed that texture). This will lead to undefined behavior, and most likely, **crash the game **.
local chan = game.engine:GetNetChan();
if chan and not chan:IsNull() then
print(chan:GetAddress());
endlocal chan = game.engine:GetNetChan();
if chan and not chan:IsNull() and chan:IsLoopback() then
print('Connected to localhost!');
endlocal chan = game.engine:GetNetChan();
if not chan or chan:IsNull() then
print('Not connected!');
endlocal chan = game.engine:GetNetChan();
if chan and not chan:IsNull() then
print('Current latency: ' .. tostring(math.round(chan:GetLatency() * 1000.0)) .. 'ms');
endlocal ent = handle:Get();if handle:Valid() then
-- ...
endif handle:IsClientSide() then
-- ...
endtex:Create();font:Destroy();attachment
?
Optional attachment mode.
owner
*?
Optional owner entity.
sound
string
Path to the sound, e.g. sounds/ui/weapon_cant_buy
volume
number
game.PlaySound('sounds/ui/weapon_cant_buy', 0.1)path
string
Particle path.
lifetime
number
Particle instance.
local particle = game.CreateParticle(
"particles/entity/spectator_utility_trail.vpcf",
2.0
)
print("particle", particle)
print("valid", particle and particle:IsValid())
if not particle or not particle:IsValid() then
return
end
particle:SetControl(16, Vector(255.0, 0.0, 0.0))
particle:SetControl(3, Vector(2.0, 1, 2.0))
particle:Initialize({
Vector(0, 0, 0),
Vector(0, 0, 0),
Vector(50, 50, 50),
Vector(50, 50, 50),
})Volume from 0 to 1, if passed -1 it uses the game's volume.
Particle lifetime in seconds.
Type
Description
float
Max speed, in UPS.
Example
Method
Returns the current inaccuracy value.
Arguments
Name
Type
Description
mode
Weapon mode.
Returns
Type
Description
float
Inaccuracy value.
Example
Method
Returns the current spread value.
Arguments
Name
Type
Description
mode
Weapon mode.
Returns
Type
Description
float
Inaccuracy value.
Example
Method
Returns the weapon definition index.
Arguments
None.
Returns
Type
Description
Weapon ID.
Example
Method
Returns the weapon type.
Arguments
None.
Returns
Type
Description
Weapon type.
Example
Method
Returns the weapon static data.
Arguments
None.
Returns
Type
Description
Weapon data.
Example
Method
Returns true if this weapon is a firearm.
Arguments
None.
Returns
Type
Description
bool
true if a firearm.
Example
Method
Returns true if you can attack with this weapon.
Arguments
None.
Returns
Type
Description
bool
true if can attack.
Example
Method
Returns true if this weapon has a secondary attack mode.
Arguments
None.
Returns
Type
Description
bool
true if has the secondary attack mode.
Example
Method
Returns true if this weapon has spread (e.g. knives do not have any spread).
Arguments
None.
Returns
Type
Description
bool
true if has spread.
Example
local spd = wep:GetMaxSpeed();local inacc = wep:GetInaccuracy(CSWeaponMode.PRIMARY_MODE);local spread = wep:GetSpread(CSWeaponMode.PRIMARY_MODE);local wep_id = wep:GetDefIndex();local type = wep:GetType();local data = wep:GetData();if wep:IsGun() then
-- ...
endif wep:IsAttackable() then
-- ...
endif wep:HasSecondaryAttack() then
-- ...
endif wep:HasSpread() then
-- ...
endIf filter is omitted, the default filter ignores the local player.
Arguments
ray
The ray or shape
from
Returns
The resulting trace object
Example
Function
Performs a trace ray call using the player movement mask. Skips local player.
Arguments
ray
The ray/shape
from
Returns
The resulting trace object
Example
Function
Performs a trace call using the grenade mask, as a line. Doesn't use a custom ray.
Arguments
from
The starting position
to
Returns
The resulting trace object
Function
Performs a trace call using the grenade mask, as a hull. Doesn't use a custom ray.
Arguments
from
The starting position
to
Returns
The resulting trace object
local filter = LuaTraceFilter_t()
filter.ignoreWorld = true
filter.ignoreEntity = entities.GetLocalPawn()
local ray = Ray_t()
local from = Vector(0, 0, 0)
local to = Vector(100, 100, 100)
local trace = game.physicsQueryInterface:TraceRay(ray, from, to, filter)local player = entities.GetLocalPawn()
local ray = Ray_t() do
local collision = player.m_pCollision:GetAs('client.dll', 'CCollisionProperty')
ray:set_hull(collision.m_vecMins:Get(), collision.m_vecMaxs:Get())
end
local from = player:GetAbsOrigin()
local to = player:GetAbsOrigin() + player:GetAbsVelocity()
local trace = game.physicsQueryInterface:TraceMovement(ray, from, to)tex
float2
Texture dimensions.
time
float
Render time (NOT the frame time).
alpha
float
Global opacity override.
The input fields are the following:
Name
Type
Description
pos
float4
Vertex position on screen (x,y,z over w). Register: SV_POSITION.
col
float4
The bound objects are the following:
Name
Type
Description
sampler0
sampler
Texture sampler.
texture0
Texture2D
Template:
Constructor
Constructs a shader.
Arguments
Name
Type
Description
src
string
Shader source code.
Returns
Type
Description
Shader
Shader object.
Example
Name
Type
Description
mvp
float4x4
Rendering system uses Shader Version 4 (ps_4_0).
Projection matrix.
cbuffer cb : register(b0) {
float4x4 mvp;
float2 tex;
float time;
float alpha;
};
struct PS_INPUT {
float4 pos : SV_POSITION;
float4 col : COLOR0;
float2 uv : TEXCOORD0;
};
sampler sampler0;
Texture2D texture0;local blur = draw.Shader([[
// define constant buffer.
cbuffer cb : register(b0) {
float4x4 mvp;
float2 tex;
float time;
float alpha;
};
// define input.
struct PS_INPUT {
float4 pos : SV_POSITION;
float4 col : COLOR0;
float2 uv : TEXCOORD0;
};
// use texture sampler and texture.
sampler sampler0;
Texture2D texture0;
float4 main(PS_INPUT inp) : SV_Target {
float radius = 2.0; // blur radius
float2 inv_size = 1.0 / tex.xy; // inversed size of the texture
float weight = 0.0; // total weight
float4 color = 0.0; // total color
// perform a gaussian blur
for (float x = -radius; x <= radius; x += 1.0)
{
for (float y = -radius; y <= radius; y += 1.0)
{
float2 coord = inp.uv + float2(x, y) * inv_size;
color += texture0.Sample(sampler0, coord) * exp(-((x * x + y * y) / (2.0 * radius * radius)));
weight += exp(-((x * x + y * y) / (2.0 * radius * radius)));
}
}
// average the color
color /= weight;
color.a *= inp.col.a; // apply alpha modulation
return color;
}
]]);All items published on the Storefront must follow these guidelines to keep the Workshop safe, usable, and fair for everyone.
Your description should clearly explain what the item does, what it requires, and any limitations it may have. Do not use vague, misleading, or clickbait-style descriptions. End users should know exactly what they are getting before they subscribe to or purchase an item.
Trivial one-line scripts, spam items, commonly made items that don't provide anything new or submissions with no truly meaningful functionality are not allowed. Workshop content should be fresh and interesting for the users, so all items must undergo a quality assurance to ensure they're not polluting the workshop with junk content.
Always use the provided APIs and tools in a way that respects user choice of permissions. Do not attempt to bypass or override capability restrictions. If your item does not need filesystem access, for example, you must not request it.
Artificial price dumping, manipulative pricing strategies, or exploitative sales tactics are not allowed. The Workshop should remain a healthy, competitive, and sustainable marketplace for all developers.
This includes malware, exploits, spyware, or any script designed to harm users or their systems. While beta branches exist for unverified testing, all items submitted to live must be safe and secure. Any attempt to sneak in harmful code will result in removal and possible bans.
Scripts and configs must not intentionally disrupt core software features, other Workshop items, or the overall stability of the platform. If your item modifies functionality, it must do so safely and predictably.
Item names, descriptions, scripts, and configs must not contain harassment, hate speech, targeted attacks, or inappropriate material. All content must follow the same standards as the forum and community guidelines.
If your script or config breaks due to updates in the core software or APIs, you are responsible for updating it. If you choose to stop maintaining an item, you must clearly mark it as deprecated so users are not misled.
Paid items must disclose exactly what features are included. You may not hide critical functionality behind unexpected paywalls or release crippled versions that require additional payment to work as advertised.
If your item uses external code, libraries, or assets, you are responsible for ensuring that you follow their licensing terms. Proper credit must be given where required, and you may not repackage or sell work you do not have rights to.
Vertex color tint (r, g, b, a). Register: COLOR0.
uv
float2
UV coordinates (u, v). Register: TEXCOORD0.
Texture object.
The starting position
to
The ending position
filter
?
Optional custom trace filter
The starting position
to
The ending position
The ending position
thrower
The entity throwing the grenade, gets skipped
ignore_breakable
boolean
Ignores any breakable objects if true
The ending position
thrower
The entity throwing the grenade, gets skipped
Description
id
string
Control ID.
Type
Description
<>?
Casted control. Returns nil if the control was not found, or casting failed.
local some_cb = gui.ctx:Find('some_cb');
This type represents a C_CSPlayerPawn class.
Method
Returns true if the game will draw this player on screen.
Arguments
None.
Returns
Example
Method
Returns true if left-hand mode is enabled.
Arguments
None.
Returns
Example
Method
Returns true if the player is alive.
Arguments
None.
Returns
Example
Method
Returns true if this player is an enemy to the local player.
Arguments
None.
Returns
Example
Method
Returns whether this player is an enemy to another entity.
Arguments
Returns
Example
Method
Returns the active weapon.
Arguments
None.
Returns
Example
Method
Returns all weapons in this player's inventory.
Arguments
None.
Returns
Example
Method
Returns the sanitized player name.
Arguments
None.
Returns
Example
Method
Returns the player's view offset (eye location relative to the player's origin).
Arguments
None.
Returns
Example
Method
Returns the player's eye position.
Arguments
None.
Returns
Example
Method
Returns hitbox information for a specific hitbox. Not to be confused with GetHitboxCenter.
Arguments
Returns
Example
Method
Returns hitbox position for a specific hitbox.
Arguments
Returns
Example
Method
Returns the bounding box rectangle for this player. Returns nil if the player is not on screen.
Arguments
None.
Returns
Example
This type is used to change render command parameters.
Be cautious when changing stuff in an instance of this type. Passing invalid data to texture or frag_shader, or not restoring some changes after you're done drawing can lead to undefined behavior, and more likely, a crash. If you are not sure how to operate this type, take a look into examples.
Field
Type: Ptr
Texture pointer. You can get one from an instance of Texture type by accessing obj field. Passing invalid data to this field WILL result in a crash. For a safer way, please use SetTexture.
Field
Type:
Fragment shader (aka Pixel Shader in DirectX terms) pointer. You can get one from an instance of type by accessing obj field. Passing invalid data to this field WILL result in a crash. For a safer way, please use .
Field
Type: ?
Clip rectangle used for scissor testing. If this is set to nil, will not clip anything.
Field
Type: ?
UV rect used for texture mapping. If this field is set to nil, will use 0, 0, 1, 1 rectangle to map the texture. You can learn more about texture mapping in the tutorial section.
Field
Type: float
Global opacity override. Defaults to 1, but if you set anything else - will modulate opacity of every next shape you will render.
Field
Type: float
Shape rotation. Not all shapes support this field. The value is set in degrees, not radians.
Field
Type: bool
If set to true, will apply tesselation to shapes.
Field
Type: bool
If set to true, will ignore global DPI scale. This is set to true by default, but you are free to change it to false if you are trying to render some custom UI elements.
Field
Type: bool
Only useful when using shaders. If set to true, will not update back buffer texture. This can be used if you need the very same texture data, as when applying several shaders to the back buffer.
Field
Type: bool
If set to true, will capture back buffer (as long as chainedCall is set to false). The name of this field is quite misleading due to the fact that in the CS:GO version of Fatality, it was used to configure if the rendering system should also downsample the captured backbuffer into another texture. In DirectX11, this operation is much faster, so it is done regardless.
Field
Type: bool
An alias to onlyDownsampled.
Field
Type: bool
If set to true, will use a separate texture sampler that supports tiling. By default, all textures are stretched, but if you enable this option - their tiling and stretch will be fully configurable by the uv_rect field.
Field
Type:
Rendering mode. You can read more about it in the type's documentation.
Method
Sets a texture in a safe manner.
Arguments
Returns
Nothing.
Example
Method
Sets a fragment shader in a safe manner.
Arguments
Returns
Nothing.
Example
This type represents the base class for font types. You cannot create an instance of this type. Instead, use the children types.
FieldRead only
Type: float
Font height, in pixels.
This table describes the rendering system of the software.
FieldRead only
Type:
There are a number of events that Fatality provides to use in the API - from various hooks, to in-game events. Each event entry is an object of . This table documents events to be used by your scripts.
Field
Invoked each time the game queues a frame for rendering. This is the only permitted location for drawing on screen.
bool
true if will.
bool
true if left-handed.
bool
true if alive.
bool
true if an enemy.
ent
Other entity.
bool
true if an enemy.
Weapon instance.
table<CHandle<C_CSWeaponBaseGun>>
Weapon list
string
Player's name.
View offset.
Eye position.
index
The hitbox ID
Hitbox info
index
The hitbox ID
The position
Player's bounding box, nil if invalid.
Name
Type
Description
tex
Texture object.
Name
Type
Description
sh
Shader object.
It is advised to instead use layer's override_clip_rect method. While you can pass custom rect to this field, you will lose information about previous clip rects set before. Using that method will make sure to intersect the previous rect with the one you pass and produce a probably more expected result.
if player:ShouldDraw() then
-- ...
endif player:IsLeftHanded() then
-- ...
endif player:IsAlive() then
-- ...
endif player:IsEnemy() then
-- ...
endif player:IsEnemyTo(other_player) then
-- ...
endlocal wep = player:GetActiveWeapon();local weapons = player:GetWeapons()
for _, handle in ipairs(weapons) do
local weapon = handle:Get()
if weapon ~= nil then
print(weapon:GetDefIndex())
end
endlocal name = player:GetName();local vo = player:GetViewOffset();local eyes = player:GetEyePos();local hbox_info = player:GetHitbox(EHitBox.HEAD);local pelvis = player:GetHitboxCenter(EHitBox.PELVIS);local bbox = player:GetBoundingBox();cmd:SetTexture(my_tex);cmd:SetShader(my_shader);Type: float
Font ascent value, in pixels.
Field
Type: float
Font descent value, in pixels.
Field
Type: float
Font line gap, in pixels.
Field
Type: float
Font kerning gap, in pixels.
Field
Type: float
Font outline opacity (0 to 1). Defaults to 0.45.
FieldRead only
Type: FontFlags
Font flags. Use bit library to read flags.
Field
Type: int
Glyph Y offset, in pixels. Will alter the location of a glyph in the atlas. Changing this value after the font was created is meaningless.
Field
Type: int
Glyph X offset, in pixels. Will alter the location of a glyph in the atlas. Changing this value after the font was created is meaningless.
Field
Type: FontBase
Fallback font to use, in case a glyph is not found in this font. Is it useful when one font does not have codepoints for specific symbols, that are present in another font, but you still want to prefer this font's glyphs over other font.
Field
Type: Color
Shadow color. Only R, G, B values are used.
Method
Returns character width, included with kerning.
Arguments
Name
Type
Description
left
int
Previous character codepoint.
right
int
Returns
Type
Description
float
Distance, in pixels.
Example
Method
Returns kerning value for a single character. If kerning is disabled, will instead return kerning gap.
Arguments
Name
Type
Description
cp
int
Codepoint.
Returns
Type
Description
float
Kerning value, in pixels.
Example
Method
Returns text area size.
Arguments
Name
Type
Description
text
string
Text.
skip_scaling
bool
Returns
Type
Description
Text area size.
Example
Method
Wraps text to meet the desired width. Wrapping is done by breaking text by words and inserting line breaks in between. If one of the words is longer than the target width, will instead use that word's width.
Arguments
Name
Type
Description
text
string
Text to wrap.
width
float
Returns
Type
Description
string
Wrapped text.
Example
Method
Returns glyph information for a character.
Arguments
Name
Type
Description
codepoint
int
Codepoint.
Returns
Type
Description
Glyph information.
Example
Method
Returns a texture atlas that contains the provided glyph.
Arguments
Name
Type
Description
gl
Character glyph.
Returns
Type
Description
int
Texture pointer, or nil if not found.
Example
local w = font:GetKernedCharWidth(prev_cp, cp);local k = font:GetKerning(cp);local sz = font:GetTextSize('Hello!');local shorter = font:WrapText('This is some very long text!', 50);local glyph = font:GetGlyph(cp);local atlas = font:GetTexture(glyph);Rendering adapter.
FieldRead only
A string to Texture map of all managed textures. You can query and push textures with custom IDs. When you add a texture to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).
FieldRead only
A string to FontBase map of all managed fonts. You can query and push fonts with custom IDs. When you add a font to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).
FieldRead only
A string to Shader map of all managed shader. You can query and push shader with custom IDs. When you add a shader to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).
FieldRead only
Type: Layer
The layer you can render on.
Method
Returns current render time, alias to m_flRealTime .
Arguments
None.
Returns
Type
Description
float
The current time
Example
Method
Returns current frame time, alias to m_flFrameTime.
Arguments
None.
Returns
Type
Description
float
The frame time
Example
Method
Returns current render DPI scaling multiplier.
Arguments
None.
Returns
Type
Description
float
The multiplier
Example
Method
Returns current render screen size, similar to GetScreenSize() .
Arguments
None.
Returns
Type
Description
The screen size
Example
Method
Finds and retrieves SVG data from Panorama and creates a new texture. Useful for retrieving icons (e.g. weapons and utilities) from the game.
Arguments
Name
Type
Description
path
string
Path to the SVG
height
number
Returns
Type
Description
The created texture
Example
local time = draw.GetTime()local time = draw.GetFrameTime()local dpi = draw.GetScale()local size = draw.GetDisplay()local tex = draw.CreatePanoramaSvgTexture('icons/equipment/inferno', 26)None.
Field
Invoked every time the game progresses onto another frame stage. This event is called before the game handles a new frame stage.
Arguments
stage
Current frame stage.
Field
Invoked every time game starts the scene rendering process. This event is called before the game's function runs.
Arguments
None.
Field
Invoked every time game starts scene rendering process. This event is called after the game's function runs.
Arguments
setup
View setup information.
Field
Invoked every time the game sets up the view information. This event is called after the game's function runs.
Arguments
None.
Field
Invoked every time the game internally overrides view information. You are free to change whatever you like in the provided view setup.
Arguments
Name
Type
Description
setup
View setup information.
Field
Invoked every time the game processes a game tick.
Arguments
Name
Type
Description
userCommand
Create move information.
Field
Invoked every time a game event fires.
Arguments
event
Game event.
Field
Invoked every time the GUI processes input.
Arguments
msg
int
System message.
w
int
Field
Invoked every time the GUI window is opened or closed.
Arguments
visible
boolean
Whether or not the menu is visible.
Field
Invoked every time before the player ESP is rendered. Useful for accessing the rendering layer for visuals or adding new elements to ESP.
Arguments
data
The player ESP data
Field
Invoked every time after the player ESP is rendered.
Arguments
data
The player ESP data
This table extends the existing math table that is a part of Lua.
Function
Calculates angles between 2 vectors.
Constructor
Creates a new 2D vector instance.
Arguments
1. Default vector (0, 0).
None.
2. Single value.
This type represents a CCSPlayerController class.
Method
Returns true if this player is an enemy to the local player.
Arguments
None.
Returns
Usage:
This type encapsulates some entity querying functionalities. If you wish to loop for players, controllers, dropped items or projectiles, go .
Function
Current character codepoint.
If set to true, will skip global DPI scaling. Defaults to false.
til_newline
bool
Calculate size only until a line break is met. Defaults to false.
Target width.
nilgui_icon_up: up chevron
gui_icon_down: down chevron
gui_icon_copy: copy icon
gui_icon_paste: paste icon
gui_icon_add: add icon
gui_icon_search: search icon
gui_icon_settings: settings icon (a cogwheel)
gui_icon_bug: bug icon
gui_icon_key.N: keyboard/mouse key icons. Replace N with the char code of a required button
icon_rage: RAGE tab icon
icon_legit: LEGIT tab icon
icon_visuals: VISUALS tab icon
icon_misc: MISC tab icon
icon_scripts: LUA tab icon
icon_skins: SKINS tab icon
icon_cloud: cloud icon
icon_file: file icon
icon_refresh: refresh icon
icon_save: save icon
icon_configs: "Configs" popup icon
icon_keys: keyboard icon
icon_info: "About" popup icon
icon_close: close icon (cross)
icon_load: load icon
icon_import: import icon
icon_export: export icon
icon_delete: delete icon
icon_autoload: "Autoload" icon
icon_allow_insecure: "Allow insecure" icon
icon_cloud_upd: cloud update icon
player_texture: player preview texture
gui_main: Figtree Medium, 14px
gui_main_shadow: Figree Medium, 14px, with shadow
gui_main_fb: Segoe UI Semibold, 14px
gui_bold: Figtree ExtraBold, 14px
gui_bold_fb: Segoe UI Black, 14px
gui_semi_bold: Figtree SemiBold, 14px
gui_semi_bold_fb: Segoe UI Bold, 14px
Height of the texture, in pixels
WPARAM.
l
int
LPARAM.
src
Source vector.
dst
Returns
Angles.
Example
Function
Normalizes an angle.
Arguments
angle
float
Input angle.
Returns
float
Normalized angle.
Example
Function
Approaches an angle over time.
Arguments
from
Start angle.
to
Returns
Delta angle.
Example
Function
Returns a point on the edge of a box.
Arguments
mins
Box mins.
maxs
Returns
Point.
Example
Function
Linear interpolation.
Arguments
t1
float
Start value.
t2
float
Returns
Type
Description
float
Interpolated value.
Example
Function
Calculates angles from a vector.
Arguments
forward
Source vector.
up
Returns
Angles.
Example
Function
Transforms a point in the game world onto the viewport.
Arguments
xyz
Point in the world.
round
bool
Returns
Point on the viewport.
Example
Function
Clamps a value between min and max.
Arguments
n
float
Value.
lower
float
Returns
float
Clamped value.
Example
Function
Maps the value from one range to another range.
Arguments
val
float
Value.
a
float
Returns
float
Mapped value.
Example
Function
Maps the value from one range to another range. Additionally, clamps the value based on the source range.
Arguments
val
float
Value.
a
float
Returns
float
Mapped value.
Example
Function
An alias to draw.Vec2.
Example
Function
An alias to Vector.
Example
local ang = math.CalcAngle(vec1, vec2);local norm = math.AngleNormalize(560);local ang = math.ApproachAngles(from, to, 1.0 / game.globalVars.frame_time);local point = math.EdgePoint(mins, maxs, dir, 5);local mid = math.Lerp(0, 100, 0.5);local ang = math.VectorAngles(fw);local point = math.WorldToScreen(game_point);local x = math.Clamp(50, 5, 25); -- 25local mapped = math.RemapVal(0.5, 0, 1, 0, 100); -- 50local mapped = math.RemapValClamped(5, 0, 1, 0, 100); -- 100local vec = math.Vec2(5, 5);local vec = math.Vec3(5, 12, 5);Type
Description
value
float
X and Y coordinates.
3. XY values.
Name
Type
Description
x
float
X coordinate.
y
float
Returns
Type
Description
Vec2
New vector.
Example
Field
Type: float
X coordinate.
Field
Type: float
Y coordinate.
Method
Returns a copy of this vector instance.
Arguments
None.
Returns
Type
Description
Vec2
The copied vector
Example
Method
Returns floored variant of this vector.
Arguments
None.
Returns
Type
Description
Vec2
Floored variant.
Example
Method
Returns ceiled variant of this vector.
Arguments
None.
Returns
Type
Description
Vec2
Ceiled variant.
Example
Method
Returns rounded variant of this vector.
Arguments
None.
Returns
Type
Description
Vec2
Rounded variant.
Example
Method
Returns length of this vector.
Arguments
None.
Returns
Type
Description
float
Length.
Example
Method
Returns squared length of this vector.
Arguments
None.
Returns
Type
Description
float
Length.
Example
Method
Returns distance to another vector.
Arguments
Name
Type
Description
other
Vec2
Other vector.
Returns
Type
Description
float
Distance.
Example
Method
Returns squared distance to another vector.
Arguments
Name
Type
Description
other
Vec2
Other vector.
Returns
Type
Description
float
Distance.
Example
Name
local vec = draw.Vec2(5, 10);local copy = vec:Clone();local fl = vec:Floor();local ceiled = vec:Ceil();local rounded = vec:Round();local len = vec:Len();local len = vec:LenSqr();local dist = vec1:Dist(vec2);local dist = vec1:DistSqr(vec2);Type
Description
bool
true if an enemy.
Example
Method
Returns the sanitized player name.
Arguments
None.
Returns
Type
Description
string
Player's name.
Example
Method
Returns the pawn attached to this controller.
Arguments
None.
Returns
Type
Description
Pawn instance.
Example
Method
Returns the active weapon.
Arguments
None.
Returns
Type
Description
Weapon instance.
Example
Method
Returns the observer pawn used for this controller.
Arguments
None.
Returns
Type
Description
?
Entity.
Example
Method
Returns the pawn this controller is currently observing.
Arguments
None.
Returns
Type
Description
?
Entity.
Example
Method
Returns the current observer mode.
Arguments
None.
Returns
Type
Description
Observer mode.
Example
Method
Returns this player's Steam ID64.
Arguments
None.
Returns
Type
Description
table<number>
The 64 bits of this player's steam ID, separated in two 32 bit values: low and high.
Example
Method
Returns this player's Steam ID64, as a string.
Arguments
None.
Returns
Type
Description
string
The steam ID in string format
Example
if player:IsEnemy() then
-- ...
endlocal name = player:GetName();local pawn = ctrl:GetPawn();local wep = player:GetActiveWeapon();local obs_pawn = ctrl:GetObserverPawn();local obs = ctrl:GetObserverTarget();local mode = ctrl:GetObserverMode();local id = ctrl:GetSteamID();
print(id.low, id.high);local id = ctrl:GetStringSteamID();
print(id);Loops for all entities with a given class.
Arguments
Name
Type
Description
className
string
The entity class name
callback
function<>
Returns
Nothing.
Example
Function
Finds and returns the first entity from a specific class.
Arguments
Name
Type
Description
className
string
The entity class name
Returns
Type
Description
| nil
The entity, nil if not found.
Example
game.gameEntitySystem:ForEachByClass('C_C4', function(entity)
if entity.m_bStartedArming:Get() then
print('Someone is planting!')
end
end)local proxy = game.gameEntitySystem:GetFirstByClass('C_CSGameRulesProxy')
local game_rules = proxy.m_pGameRules:GetAs('client.dll', 'C_CSGameRules')
if not game_rules then
error('Not found')
end
print(game_rules.m_bWarmupPeriod:Get())This type encapsulates all of the hitbox information that can be retrieved.
Method
Returns the name of the hitbox.
Arguments
None.
Returns
Example
Method
Returns the hitbox's surface property.
Arguments
None.
Returns
Example
Method
Returns the hitbox's bone name.
Arguments
None.
Returns
Example
Method
Returns the hitbox's minimum bounds.
Arguments
None.
Returns
Example
Method
Returns the hitbox's maximum bounds.
Arguments
None.
Returns
Example
Method
Returns the hitbox's radius.
Arguments
None.
Returns
Example
Method
Returns the hitbox's name hash.
Arguments
None.
Returns
Example
Method
Returns the hitbox's group ID.
Arguments
None.
Returns
Example
Method
Returns whether the hitbox only translates or not.
Arguments
None.
Returns
Example
Method
Returns the hitbox's CRC value.
Arguments
None.
Returns
Example
Method
Returns the hitbox's rendering color. Not really useful.
Arguments
None.
Returns
Example
Method
Returns the hitbox's unique index.
Arguments
None.
Returns
Example
Y coordinate.
The loop callback
Destination vector.
End angle.
speed
float
Approach speed.
Box maxs.
dir
Point direction (angle).
radius
float
Area radius.
End value.
progress
float
Interpolation amount.
Up vector. Defaults to nil.
Whether should round the output. Defaults to true.
Lowest value.
upper
float
Highest value.
Lowest source value.
b
float
Highest source value.
c
float
Lowest destination value.
d
float
Highest destination value.
Lowest source value.
b
float
Highest source value.
c
float
Lowest destination value.
d
float
Highest destination value.
Type
Description
string
The name
local hbox_name = hitbox:GetName();Type
Description
string
The hitbox property
local prop = hitbox:GetSurfaceProperty();Type
Description
string
The hitbox bone
local bone_name = hitbox:GetBoneName();Type
Description
The mins
local mins = hitbox:GetMinBounds();Type
Description
The maxs
local maxs = hitbox:GetMaxBounds();Type
Description
number
The radius
local radius = hitbox:GetShapeRadius();Type
Description
number
The hash
local hash = hitbox:GetBoneNameHash();Type
Description
number
The ID
local id = hitbox:GetGroupID();Type
Description
boolean
The ID
local translate = hitbox:IsTranslationOny();Type
Description
number
The CRC
local crc = hitbox:GetCRC();Type
Description
userdata
The color
local crc = hitbox:GetRenderColor();Type
Description
number
The index
local hbox_index = hitbox:GetHitboxIndex();This type represents the GUI input context.
Method
Returns current cursor position.
Arguments
None.
Returns
Example
Method
Returns previous cursor position.
Arguments
None.
Returns
Example
Method
Delta value between previous and current cursor positions.
Arguments
None.
Returns
Example
Method
Returns true if the cursor did move since the last input.
Arguments
None.
Returns
Example
Method
Returns true if mouse scroll wheel did move since the last input.
Arguments
None.
Returns
Example
Method
Returns true if any mouse key's state had changed.
Arguments
None.
Returns
Example
Method
Returns true if any key was released since the last input.
Arguments
None.
Returns
Example
Method
Returns the amount of rows scrolled this input.
Arguments
None.
Returns
Example
Method
Returns true if the mouse key is up (depressed).
Arguments
Returns
Example
Method
Returns true if the mouse key is down (pressed).
Arguments
Returns
Example
Method
Returns true if the mouse key is clicked (switched from depressed to pressed state).
Arguments
Returns
Example
Method
Returns true if the mouse key is released (switched from pressed to depressed state).
Arguments
Returns
Example
Method
Returns true if any key's state had changed.
Arguments
None.
Returns
Example
Method
Returns true if a key is up (depressed).
Arguments
Returns
Example
Method
Returns true if a key is down (pressed).
Arguments
Returns
Example
Method
Returns true if a key is clicked (switched from depressed to pressed state).
Arguments
Returns
Example
Method
Returns true if a key is released (switched from pressed to depressed state).
Arguments
Returns
Example
This type represents a bitset value.
Maximal bit number for this type is 63. Setting or getting any bits outside of that range will cause a crash.
Method
Resets the value.
Arguments
None.
Returns
Nothing.
Example
bits:Reset();Method
Returns the raw value.
Arguments
None.
Returns
Example
Method
Sets the raw value.
Arguments
Returns
Nothing.
Example
Method
Returns true if no bits are set.
Arguments
None.
Returns
Example
Method
Enables a bit.
Arguments
Returns
Nothing.
Example
Method
Disables a bit.
Arguments
Returns
Nothing.
Example
Method
Returns bit state.
Arguments
Returns
Example
Method
Toggles bit state.
Arguments
Returns
Nothing.
Example
This type represents a base game entity.
Function
Attemps to search for a field in this class.
Arguments
In order to update an item you need to follow these steps:
Check on how to upload a build.
Navigate to Builds and find the approved build.
Click Set to branch
Select Default branch
Type
Description
int
Raw value.
Name
Type
Description
val
int
Raw value.
Type
Description
bool
true if no bits are set.
Name
Type
Description
bit
int
Bit number.
Name
Type
Description
bit
int
Bit number.
Name
Type
Description
bit
int
Bit number.
Type
Description
bool
Bit status.
Name
Type
Description
bit
int
Bit number.
local raw = bits:GetRaw();bits:SetRaw(long_long_value);if bits:None() then
-- ...
endbits:Set(5); -- set bit #5 (same as bit.bor(val, bit.lshift(1, 5)))bits:Unset(5);if bits:Get(5) then
-- ...
endbits:Toggle(5);Returns
Example
Function
Returns schema class name.
Returns
Example
Function
Returns handle for this entity.
Returns
Example
Function
Returns a memory address for this entity, useful with FFI.
Returns
Example
Function
Safe-casts the entity to , returns nil if not a .
Returns
Example
Function
Safe-casts the entity to , returns nil if not a .
Returns
Example
Function
Safe-casts the entity to , returns nil if not a .
Returns
Example
Function
Safe-casts the entity to , returns nil if not a .
Returns
Example
Method
Returns the absolute origin (the one that is used for rendering).
Arguments
None.
Returns
Example
Method
Returns the absolute angles (the one that is used for rendering).
Arguments
None.
Returns
Example
Method
Returns the absolute velocity.
Arguments
None.
Returns
Example
Method
Sets the new absolute origin.
Arguments
Returns
Nothing.
Example
Method
Sets new absolute angles.
Arguments
Returns
Nothing.
Example
Method
Sets new absolute velocity.
Arguments
Returns
Nothing.
Example
Name
Type
Description
This type may be returned for any other abstract entity class, but internally will point to the correct type.
Click Save
After these actions are complete, your new build will be available for users instantly.
Additionally, you may want to test upcoming builds before they hit the Live item. For that, we recommend looking into .
Type
Description
Cursor position.
local cur = gui.input:Cursor();Type
Description
Previous cursor position.
local prev = gui.input:CursorPrev();Type
Description
Cursor delta.
local delta = gui.input:CursorDelta();Type
Description
bool
true if moved.
if gui.input:DidCursorMove() then
-- ...
endType
Description
bool
true if moved.
if gui.input:DidWheelMove() then
-- ...
endType
Description
bool
true if processed.
if gui.input:DidProcessMouse() then
-- ...
endType
Description
bool
true if released.
if gui.input:button_released() then
-- ...
endType
Description
float
Rows scrolled.
local scroll = gui.input:WheelDelta();Name
Type
Description
mb
Mouse button.
Type
Description
bool
true if depressed.
if gui.input:IsMouseUp(gui.MouseButton.LEFT) then
-- ...
endName
Type
Description
mb
Mouse button.
Type
Description
bool
true if pressed.
if gui.input:IsMouseDown(gui.MouseButton.LEFT) then
-- ...
endName
Type
Description
mb
Mouse button.
Type
Description
bool
true if clicked.
if gui.input:IsMouseClicked(gui.MouseButton.LEFT) then
-- ...
endName
Type
Description
mb
Mouse button.
Type
Description
bool
true if released.
if gui.input:IsMouseReleased(gui.MouseButton.LEFT) then
-- ...
endType
Description
bool
true if state changed.
if gui.input:DidProcessKey() then
-- ...
endName
Type
Description
k
int
Virtual key.
Type
Description
bool
true if depressed.
if gui.input:IsKeyUp(0x41) then -- 0x41 = "A"
-- ...
endName
Type
Description
k
int
Virtual key.
Type
Description
bool
true if pressed.
if gui.input:IsKeyDown(0x41) then -- 0x41 = "A"
-- ...
endName
Type
Description
k
int
Virtual key.
Type
Description
bool
true if clicked.
if gui.input:IsKeyClicked(0x41) then -- 0x41 = "A"
-- ...
endName
Type
Description
k
int
Virtual key.
Type
Description
bool
true if released.
if gui.input:IsKeyReleased(0x41) then -- 0x41 = "A"
-- ...
endBuilds are NOT automatically set to the Default branch upon approval! Once you get the notification that your build has been approved, proceed to set its branch to Default.

name
string
Field name.
Type
Description
Accessor instance or pointer accessor instance
Type
Description
string
Name. Returns nil when failed.
Type
Description
Entity handle
Type
Description
userdata
Entity pointer
Type
Description
Casted entity. Returns nil if the cast failed.
Type
Description
Casted entity. Returns nil if the cast failed.
Type
Description
Casted entity. Returns nil if the cast failed.
Type
Description
Casted entity. Returns nil if the cast failed.
Type
Description
Origin.
Type
Description
Angles.
Type
Description
Velocity.
Name
Type
Description
vec
New origin.
Name
Type
Description
ang
New angles.
Name
Type
Description
vel
New velocity.
local health = player.m_iHealth;
local health = player['m_iHealth']; -- this also workslocal name = entity:GetClassName()local name = entity:GetHandle()local name = entity:GetPointer()local gun = entity:ToWeaponBaseGun()local wpn = entity:ToWeaponBase()local pawn = entity:ToPlayerPawn()local controller = entity:ToPlayerController()local org = entity:GetAbsOrigin();local ang = entity:GetAbsAngles();local vel = entity:GetAbsVelocity();entity:SetAbsOrigin(my_vec);entity:SetAbsAngles(my_ang);entity:SetAbsVelocity(my_vel);Encapsulates all tracing information returned by the tracing methods.
FieldRead only
Type: C_BaseEntity
FieldRead only
Type: CHandle
FieldRead only
Type:
FieldRead only
Type:
FieldRead only
Type:
FieldRead only
Type: number
FieldRead only
Type: number
FieldRead only
Type: number
FieldRead only
Type: boolean
Method
Returns whether or not the trace hit an entity or the world.
Arguments
Nothing.
Returns
Method
Returns whether or not the trace hit the world.
Arguments
Nothing.
Returns
Type
Description
boolean
Whether it hit something or not
Type
Description
boolean
Whether it hit the world or not
This type is used to determine text alignment.
Function
Creates TextParams instance with vertical alignment.
Arguments
Name
Returns
Example
Function
Creates TextParams instance with horizontal alignment.
Arguments
Returns
Example
Function
Creates TextParams instance with line alignment.
Arguments
Returns
Example
Function
Creates TextParams instance with vertical and horizontal alignments.
Arguments
Returns
Example
Function
Creates TextParams instance with vertical alignment and line alignment.
Arguments
Returns
Example
Function
Creates TextParams instance with horizontal alignment and line alignment.
Arguments
Returns
Example
Function
Creates TextParams instance with vertical, horizontal and line alignments.
Arguments
Returns
Example
This enum represents the unique identifier for various weapons in the game.
Field
Represents no weapon.
Field
Represents a Desert Eagle.
Type
Description
v
Vertical alignment.
Type
Description
TextParams
Created text params.
local align_top = draw.TextParams.WithV(draw.TextAlignment.TOP);Name
Type
Description
h
Horizontal alignment.
Type
Description
TextParams
Created text params.
local align_right = draw.TextParams.WithH(draw.TextAlignment.RIGHT);Name
Type
Description
line
Line alignment.
Type
Description
TextParams
Created text params.
local lines_center = draw.TextParams.WithLine(draw.TextAlignment.CENTER);Name
Type
Description
v
Vertical alignment.
h
Type
Description
TextParams
Created text params.
local align_bottom_right = draw.TextParams.WithVH(draw.TextAlignment.BOTTOM, draw.TextAlignment.RIGHT);Name
Type
Description
v
Vertical alignment.
line
Type
Description
TextParams
Created text params.
local align = draw.TextParams.WithVLine(draw.TextAlignment.BOTTOM, draw.TextAlignment.CENTER);Name
Type
Description
h
Horizontal alignment.
line
Type
Description
TextParams
Created text params.
local align = draw.TextParams.WithHLine(draw.TextAlignment.CENTER, draw.TextAlignment.CENTER);Name
Type
Description
v
Vertical alignment.
h
Type
Description
TextParams
Created text params.
local align = draw.TextParams.WithVHLine(draw.TextAlignment.CENTER, draw.TextAlignment.CENTER, draw.TextAlignment.CENTER);Represents the Dual Berettas.
Field
Represents a Five-SeveN.
Field
Represents a Glock-18.
Field
Represents an AK-47.
Field
Represents an AUG.
Field
Represents an AWP.
Field
Represents a FAMAS.
Field
Represents a G3SG1.
Field
Represents a Galil AR.
Field
Represents an M249.
Field
Represents an M4A4.
Field
Represents a MAC-10.
Field
Represents a P90.
Field
Represents a zone repulsor device.
Field
Represents an MP5-SD.
Field
Represents a UMP-45.
Field
Represents an XM1014.
Field
Represents a PP-Bizon.
Field
Represents a MAG-7.
Field
Represents a Negev.
Field
Represents a Sawed-Off.
Field
Represents a Tec-9.
Field
Represents a Zeus x27 taser.
Field
Represents a P2000.
Field
Represents an MP7.
Field
Represents an MP9.
Field
Represents a Nova.
Field
Represents a P250.
Field
Represents a shield.
Field
Represents a SCAR-20.
Field
Represents an SG 553.
Field
Represents an SSG 08.
Field
Represents the Golden Knife.
Field
Represents the default knife.
Field
Represents a flashbang.
Field
Represents an HE grenade.
Field
Represents a smoke grenade.
Field
Represents a Molotov.
Field
Represents a decoy grenade.
Field
Represents an incendiary grenade.
Field
Represents a C4 explosive.
Field
Represents a health shot.
Field
Represents the Terrorist knife.
Field
Represents the M4A1-S.
Field
Represents the USP-S.
Field
Represents a CZ75-Auto.
Field
Represents an R8 Revolver.
Field
Represents a tactical awareness grenade.
Field
Represents fists.
Field
Represents a breach charge.
Field
Represents a tablet.
Field
Represents a generic melee weapon.
Field
Represents an axe.
Field
Represents a hammer.
Field
Represents a spanner (wrench).
Field
Represents a ghost knife.
Field
Represents a firebomb grenade.
Field
Represents a diversion device.
Field
Represents a fragmentation grenade.
Field
Represents a snowball.
Field
Represents a bump mine.
Field
Represents a Bayonet.
Field
Represents the Classic Knife.
Field
Represents a Flip Knife.
Field
Represents a Gut Knife.
Field
Represents a Karambit.
Field
Represents an M9 Bayonet.
Field
Represents a Huntsman Knife.
Field
Represents a Falchion Knife.
Field
Represents a Bowie Knife.
Field
Represents a Butterfly Knife.
Field
Represents a Shadow Daggers.
Field
Represents a Paracord Knife.
Field
Represents a Survival Knife.
Field
Represents an Ursus Knife.
Field
Represents a Navaja Knife.
Field
Represents a Nomad Knife.
Field
Represents a Stiletto Knife.
Field
Represents a Talon Knife.
Field
Represents a Skeleton Knife.
Field
Represents a Kukri Knife.
Horizontal alignment.
Line alignment.
Line alignment.
Horizontal alignment.
line
Line alignment.
Constructor
Creates a new rectangle.
Arguments
1. Default rectangle (0, 0 position; 0, 0 size).
None.
2. Single value.
3. Single vector.
4. Double value.
5. Double vector.
6. Four values.
Returns
Example
Field
Type:
Mins (top-left) vector.
Field
Type:
Maxs (bottom-right) vector.
Method
Either returns rectangle's width, or sets a new width.
Arguments
1. Get width.
None.
2. Set width.
Returns
1. Get width.
2. Set width.
Example
Method
Either returns rectangle's height, or sets a new height.
Arguments
1. Get height.
None.
2. Set height.
Returns
1. Get height.
2. Set height.
Example
Method
Either returns rectangle's size, or sets a new size.
Arguments
1. Get size.
None.
2. Set size.
Returns
1. Get size.
2. Set size.
Example
Method
Explodes the rectangle by given vector (increase size from center into all directions by coordinates in the vector).
Arguments
Returns
Example
Method
Returns a rectangle with half of the width of this rectangle.
Arguments
None.
Returns
Example
Method
Translates (moves) this rectangle by vector coordinates.
Arguments
Returns
Example
Method
Move rectangle from the left by given amount.
Arguments
Returns
Example
Method
Move rectangle from the right by given amount.
Arguments
Returns
Example
Method
Move rectangle from the top by given amount.
Arguments
Returns
Example
Method
Move rectangle from the bottom by given amount.
Arguments
Returns
Example
Method
Adds the value to the left side of the rectangle.
Arguments
Returns
Example
Method
Adds the value to the right side of the rectangle.
Arguments
Returns
Example
Method
Adds the value to the top side of the rectangle.
Arguments
Returns
Example
Method
Adds the value to the bottom side of the rectangle.
Arguments
Returns
Example
Method
Shrinks (implodes) the rectangle by given amount.
Arguments
Returns
Example
Method
Expands (explodes) the rectangle by given amount.
Arguments
Returns
Example
Method
Returns true if this rectangle contains either vector or another rectangle.
Arguments
1. Vector variant.
2. Rectangle variant.
Returns
Example
Method
Returns true if the other rectangle overlaps with this rectangle.
Arguments
Returns
Example
Method
Intersects this rectangle with another rectangle.
Arguments
Returns
Example
Method
Returns top-left vector.
Arguments
None.
Returns
Example
Method
Returns top-right vector.
Arguments
None.
Returns
Example
Method
Returns bottom-right vector.
Arguments
None.
Returns
Example
Method
Returns bottom-left vector.
Arguments
None.
Returns
Example
Method
Returns center point of this rectangle.
Arguments
None.
Returns
Example
Method
Treats this rectangle as an ellipsis and returns point on it. Note, that this "ellipsis" will be perfect with no modified curvature (basically if this rectangle is a box - you will get a point on a perfect circle).
Arguments
Returns
Example
Method
Returns floored rectangle.
Arguments
None.
Returns
Example
Method
Returns ceiled rectangle.
Arguments
None.
Returns
Example
Method
Returns rounded rectangle.
Arguments
None.
Returns
Example
Method
Returns true if both mins and maxs are equal to 0.
Arguments
None.
Returns
Example
value
float
Mins XY, maxs XY value.
value
Mins vector, maxs vector.
x
float
Mins/maxs X coordinate.
y
float
mins
Mins vector.
maxs
x0
float
Mins X coordinate.
y0
float
Rect
New rectangle.
local my_rect = draw.Rect(50, 50, 150, 150);value
float
New width.
float
Width.
Rect
New rectangle with changed width.
local half_width = rect:Width(rect:Width() * 0.5);value
float
New height.
float
Height.
Rect
New rectangle with changed height.
local half_height = rect:Height(rect:Height() * 0.5);value
New size.
Size.
Rect
New rectangle with changed size.
local half_size = rect:Size(rect:Size() * draw.Vec2(0.5, 0.5));value
Explode size.
Rect
Exploded rectangle.
local exp = rect:Explode(draw.Vec2(6, 6)); -- will subtract -3,-3 from mins and add 3,3 to maxsRect
Rectangle with halved width.
local half = rect:HalfWidth();value
Translation amount.
Rect
Translated rectangle.
local rect = draw.Rect(50, 50, 150, 150);
local translated = rect:Translate(draw.Vec2(5, 5)); -- mins/maxs will be 55,55 and 155,155value
float
Margin amount.
Rect
Moved rectangle.
local new = rect:MarginLeft(5); -- moves to the right by 5pxvalue
float
Margin amount.
Rect
Moved rectangle.
local new = rect:MarginRight(5); -- moves to the left by 5pxvalue
float
Margin amount.
Rect
Moved rectangle.
local new = rect:MarginTop(5); -- moves to the bottom by 5pxvalue
float
Margin amount.
Rect
Moved rectangle.
local new = rect:MarginBottom(5); -- moves to the top by 5pxvalue
float
Padding amount.
Rect
Resized rectangle.
local new = rect:PaddingLeft(5); -- adds 5 to mins xvalue
float
Padding amount.
Rect
Resized rectangle.
local new = rect:PaddingRight(5); -- adds 5 to maxs xvalue
float
Padding amount.
Rect
Resized rectangle.
local new = rect:PaddingTop(5); -- adds 5 to mins yvalue
float
Padding amount.
Rect
Resized rectangle.
local new = rect:PaddingBottom(5); -- adds 5 to maxs yvalue
float
Shrink value.
Rect
Resized rectangle.
local shrinked = rect:Shrink(5); -- adds 5,5 to mins and subtracts 5,5 from maxsvalue
float
Expand value.
Rect
Resized rectangle.
local expanded = rect:Expand(5); -- subtracts 5,5 from mins and adds 5,5 to maxsother
Vector to check against.
other
Rect
Rectangle to check against.
bool
true if other object is in bounds of this rectangle.
if rect:Contains(cursor_pos) then
-- ...
endother
Rect
Rectangle to check against.
bool
true if other rectangle overlaps with this rectangle.
if rect:Overlaps(another_rect) then
-- ...
endother
Rect
Rectangle to intersect with.
Rect
Intersected rectangle.
local intersected = rect:Intersect(another_rect);Top-left vector.
local tl = rect:TL();Top-right vector.
local tr = rect:TR();Bottom-right vector.
local br = rect:BR();Bottom-left vector.
local bl = rect:BL();Center point.
local center = rect:Center();r
float
Radians value.
Point on the ellipsis.
local point = rect:Circle(rad(250)); -- returns point on the 250th degreeRect
Floored rectangle.
local floored = rect:Floor();Rect
Ceiled rectangle.
local ceiled = rect:Ceil();Rect
Rounded rectangle.
local rounded = rect:Round();bool
true if this is a zero rectangle.
if rect:IsZero() then
-- ...
endMins/maxs Y coordinate.
Maxs vector.
Mins Y coordinate.
x1
float
Maxs X coordinate.
y1
float
Maxs Y coordinate.
Last modified: 03 January 2025
This type is a color used within the rendering system.
Do not mistake this type with that is used in game! While these types are interchangeable internally, they are NOT in the API.
Constructor
Creates a new color instance.
Arguments
1. Default color (translucent black).
None.
2. Integer colors.
3. Hex string.
Returns
Example
Function
Returns a white, opaque color.
Arguments
None.
Returns
Example
Function
Returns a white, transparent color.
Arguments
None.
Returns
Example
Function
Returns a black, opaque color.
Arguments
None.
Returns
Example
Function
Returns a black, transparent color.
Arguments
None.
Returns
Example
Function
Returns a red-to-green color, depending on the provided percent.
Arguments
Returns
Example
Function
Returns a black-to-white color, depending on the provided percent.
Arguments
Returns
Example
Function
Interpolates two colors.
Arguments
Returns
Example
Method
Returns integer representation of this color (RGBA format)
Arguments
None.
Returns
Example
Method
Returns integer representation of this color (ARGB format)
Arguments
None.
Returns
Example
Method
Returns integer representation of this color (BGRA format)
Arguments
None.
Returns
Example
Method
Returns integer representation of this color (ABGR format)
Arguments
None.
Returns
Example
Method
Returns darker variant of this color.
Arguments
Returns
Example
Method
Returns saturated version of this color. Opposite of darken.
Arguments
Returns
Example
Method
Modulate opacity of the color. This will take existing opacity, and multiply it by whatever value you provide. It is useful if you want to modulate same color in steps, instead of setting the accurate opacity number.
Arguments
1. Float variant.
2. Integer variant.
Returns
Example
Method
Override red and return new color.
Arguments
Returns
Example
Method
Override green and return new color.
Arguments
Returns
Example
Method
Override blue and return new color.
Arguments
Returns
Example
Method
Override opacity and return new color.
Arguments
Returns
Example
Method
Returns red color value.
Arguments
None.
Returns
Example
Method
Returns green color value.
Arguments
None.
Returns
Example
Method
Returns blue color value.
Arguments
None.
Returns
Example
Method
Returns opacity color value.
Arguments
None.
Returns
Example
Method
Return hue value of the color.
Arguments
None.
Returns
Example
Method
Returns saturation value of the color.
Arguments
None.
Returns
Example
Method
Returns brightness value of the color.
Arguments
None.
Returns
Example
Method
Construct new color from provided HSB values.
Arguments
Returns
Example
Name
Type
Description
r
int
Red color (0 to 255).
g
int
Green color (0 to 255).
Name
Type
Description
hex
string
Hex string. Formats are: #rrggbbaa, #rrggbb, #rgba and #rgb.
Type
Description
Color
Color object.
local white = draw.Color(255, 255, 255);Type
Description
Color
Color object.
local white = draw.color.White();Type
Description
Color
Color object.
local white_t = draw.color.WhiteTransparent();Type
Description
Color
Color object.
local black = draw.color.Black();Type
Description
Color
Color object.
local black_t = draw.color.BlackTransparent();Name
Type
Description
p
float
Percentile (0 to 1).
a
float
Type
Description
Color
Color object.
local yellow = draw.color.Percent(0.5);Name
Type
Description
b
float
Percentile (0 to 1).
a
float
Type
Description
Color
Color object.
local gray = draw.color.Gray(0.5);Name
Type
Description
a
Color
Starting color.
b
Color
Type
Description
Color
Color object.
local a = draw.color.White();
local b = draw.color.Black();
local i = draw.color.Interpolate(a, b, 0.5); -- grayType
Description
int
RGBA color.
local num = col:RGBA();Type
Description
int
ARGB color.
local num = col:argb();Type
Description
int
BGRA color.
local num = col:BGRA();Type
Description
int
ABGR color.
local num = col:ABGR();Name
Type
Description
value
float
Modulation amount (0 to 1).
Type
Description
Color
Darker color.
local darker = col:Darken(0.5);Name
Type
Description
value
float
Modulation amount (0 to 1).
Type
Description
Color
Saturated color.
local saturated = col:Lighten(0.5);Name
Type
Description
value
float
Opacity modulation (0 to 1).
Name
Type
Description
value
int
Opacity modulation (0 to 255).
Type
Description
Color
Modulated color.
local half_opacity = col:ModA(0.5);Name
Type
Description
value
float
New value.
Type
Description
Color
New color.
local full_red = col:R(1);Name
Type
Description
value
float
New value.
Type
Description
Color
New color.
local full_green = col:G(1);Name
Type
Description
value
float
New value.
Type
Description
Color
New color.
local full_blue = col:B(1);Name
Type
Description
value
float
New value.
Type
Description
Color
New color.
local full_opacity = col:A(1);Type
Description
int
Color value.
local r = col:GetR();Type
Description
int
Color value.
local g = col:GetG();Type
Description
int
Color value.
local b = col:GetB();Type
Description
int
Color value.
local a = col:GetA();Type
Description
int
Hue (0 to 359).
local hue = col:H();Type
Description
float
Saturation (0 to 1).
local saturation = col:S();Type
Description
float
Brightness (0 to 1).
local brightness = col:V();Name
Type
Description
hue
int
Hue (0 to 359).
saturation
float
Type
Description
Color
New color.
local new_col = col:HSV(250, 0.5, 0.1);b
int
Blue color (0 to 255).
a
int
Opacity (0 to 255). Defaults to 255.
Opacity. Defaults to 1.
Opacity. Defaults to 1.
Ending color.
t
float
Interpolation percentile.
Saturation (0 to 1).
brightness
float
Brightness (0 to 1).
alpha
float
Override opacity of the source color. Must be either left out, or provided 0 to 1 value.
A layer is a type that is used to store render commands, as well as vertex and index data. This is the only way to push shapes and control rendering state.
FieldRead only
Type: Command
The next render command to be pushed to the queue. This is the object you want to change to, for example, set a texture, or change rendering modes.
Field
Type:
Font to use with add_text. If nothing has been set, no text will get rendered.
Field
Type:
Texture dimensions. This value is only required if you are trying to render rounded shapes with a texture, so the rendering system will correctly map your UV coordinates to whatever shape you are rendering.
Field
Type: bool
If set to true, will skip global DPI scale. Defaults to true.
Method
Adds a filled triangle with a single color.
Arguments
Returns
Nothing.
Example
Method
Adds a filled quad with a single color.
Arguments
Returns
Nothing.
Example
Method
Adds a filled rectangle with a single color.
Arguments
Returns
Nothing.
Example
Method
Adds a filled circle with a single color.
Arguments
Returns
Nothing.
Example
Method
Adds a filled, multicolor triangle.
Arguments
Returns
Nothing.
Example
Method
Adds a filled, multicolor rectangle.
Arguments
Returns
Nothing.
Example
Method
Adds a filled, multicolor circle.
Arguments
Returns
Nothing.
Example
Method
Adds a filled, multicolor quad.
Arguments
Returns
Nothing.
Example
Method
Adds a multicolor pill shape.
Arguments
Returns
Nothing.
Example
Method
Adds a shadow line.
Arguments
Returns
Nothing.
Example
Method
Adds a shadowed rectangle.
Arguments
Returns
Nothing.
Example
Method
Adds a glow box.
Arguments
Returns
Nothing.
Example
Method
Adds a filled, rounded rectangle.
Arguments
Returns
Nothing.
Example
Method
Adds a filled, multicolor rounded rectangle.
Arguments
Returns
Nothing.
Example
Method
Adds a stroked triangle.
Arguments
Returns
Nothing.
Example
Method
Adds a stroked quad.
Arguments
Returns
Nothing.
Example
Method
Adds a stroked rectangle.
Arguments
Returns
Nothing.
Example
Method
Adds a stroked circle.
Arguments
Returns
Nothing.
Example
Method
Adds a line.
Arguments
Returns
Nothing.
Example
Method
Adds a multicolor line.
Arguments
Returns
Nothing.
Example
Method
Adds a rounded, filled rectangle.
Arguments
Returns
Nothing.
Example
Method
Adds text.
Arguments
Returns
Nothing.
Example
Method
Overrides clip rectangle with support of intersection.
Arguments
Returns
Nothing.
Example
Method
Renders a section with blur applied to it.
Arguments
Returns
Nothing.
Example
Method
Renders a section with blur applied to it. Uses a shared texture.
Arguments
Returns
Nothing.
Example
Method
Renders a section with a frosted effect to it, like in the Xmas theme.
Arguments
Returns
Nothing.
Example
Name
Type
Description
a
A point.
b
layer:AddTriangleFilled(
draw.Vec2(50, 50), draw.Vec2(25, 75),
draw.Vec2(75, 75), draw.Color(255, 255, 255));Name
Type
Description
tl
Top left point.
tr
layer:AddQuadFilled(
draw.Vec2(50, 50), draw.Vec2(100, 60),
draw.Vec2(100, 100), draw.Vec2(30, 70),
draw.Color(255, 255, 255));Name
Type
Description
r
Rectangle.
col
layer:AddRectFilled(draw.Rect(50, 50, 150, 150), draw.Color(255, 255, 255));Name
Type
Description
center
Center point.
radius
float
layer:AddCircleFilled(draw.Vec2(50, 50), 10, draw.Color(255, 255, 255));Name
Type
Description
a
A point.
b
layer:AddTriangleFilledMulticolor(
draw.Vec2(50, 50), draw.Vec2(25, 75),
draw.Vec2(75, 75), {
draw.Color(255, 0, 0),
draw.Color(0, 255, 0),
draw.Color(0, 0, 255)
});Name
Type
Description
r
Rectangle.
cols
table[, , , ]
layer:AddRectFilledMulticolor(
draw.Rect(50, 50, 150, 150), {
draw.Color(255, 0, 0),
draw.Color(0, 255, 0),
draw.Color(0, 0, 255),
draw.Color(255, 255, 0)
});Name
Type
Description
center
Center point.
radius
float
layer:AddCircleFilledMulticolor(
draw.Vec2(100, 100), 50, {
draw.Color(255, 0, 0),
draw.Color(0, 0, 255)
}, 36, 1.0);Name
Type
Description
tl
Top left point.
tr
layer:AddQuadFilledMulticolor(
draw.Vec2(50, 50), draw.Vec2(150, 50),
draw.Vec2(150, 150), draw.Vec2(50, 150), {
draw.Color(255, 0, 0),
draw.Color(0, 0, 255)
});Name
Type
Description
mins
Top left point of the pill.
maxs
layer:AddPillMulticolor(
draw.Vec2(50, 50), draw.Vec2(150, 100),
10, 20, {
draw.Color(255, 0, 0),
draw.Color(0, 0, 255)
}, 16);Name
Type
Description
r
Bounding box for the shadow line.
dir
layer:AddShadowLine(
draw.Rect(50, 50, 150, 150), draw.ShadowDir.DOWN, 0.25);Name
Type
Description
r
Rectangle.
radius
float
layer:AddShadowRect(
draw.Rect(50, 50, 150, 150), 15, true, 0.25);Name
Type
Description
r
Box rectangle.
radius
float
layer:AddGlow(draw.Rect(50, 50, 150, 150), 15, draw.Color(255, 0, 0));Name
Type
Description
r
Rectangle.
c
layer:AddRectFilledRounded(
draw.Rect(50, 50, 150, 150),
draw.Color(255, 0, 0),
10,
draw.Rounding.ALL
);Name
Type
Description
r
Rectangle.
c
table[, , , ]
layer:AddRectFilledRoundedMulticolor(
draw.Rect(50, 50, 150, 150), {
draw.Color(255, 0, 0),
draw.Color(0, 255, 0),
draw.Color(0, 0, 255),
draw.Color(255, 255, 0)
},
10,
draw.Rounding.ALL
);Name
Type
Description
a
Point A.
b
layer:AddTriangle(
draw.Vec2(50, 50),
draw.Vec2(25, 75),
draw.Vec2(75, 75),
draw.Color(255, 0, 0),
1.0,
draw.OutlineMode.INSET
);Name
Type
Description
tl
Top-left point.
tr
layer:AddQuad(
draw.Vec2(50, 50),
draw.Vec2(150, 50),
draw.Vec2(150, 150),
draw.Vec2(50, 150),
draw.Color(255, 0, 0),
1.0,
draw.OutlineMode.INSET
);Name
Type
Description
r
Rectangle.
c
layer:AddRect(
draw.Rect(50, 50, 150, 150),
draw.Color(255, 0, 0),
1.0,
draw.OutlineMode.INSET
);Name
Type
Description
center
Center point.
radius
layer:AddCircle(
draw.Vec2(100, 100),
50,
draw.Color(255, 0, 0),
36,
1.0,
1.0,
draw.OutlineMode.INSET
);Name
Type
Description
a
Start point.
b
layer:AddLine(
draw.Vec2(50, 50),
draw.Vec2(150, 150),
draw.Color(255, 0, 0)
);Name
Type
Description
a
Start point.
b
layer:AddLineMulticolor(
draw.Vec2(50, 50),
draw.Vec2(150, 150),
draw.Color(255, 0, 0),
draw.Color(0, 0, 255),
2.0
);Name
Type
Description
r
Rectangle.
c
layer:AddRectRounded(draw.Rect(50, 50, 150, 150),
draw.Color(255, 255, 255), 14);Name
Type
Description
p
Text origin point.
text
string
layer:AddText(draw.Vec2(50, 50), 'Hello world!', draw.Color(255, 255, 255));Name
Type
Description
r
?
New clip rect.
intersect
bool
layer:OverrideClipRect(draw.Rect(50, 50, 150, 150));Name
Type
Description
area
Blurred area
callback
function
layer:AddWithBlur(draw.Rect(0, 0, 200, 200), function()
layer:AddText(draw.Vec2(100, 100), "I'm so blurry!", draw.Color.White())
end)Name
Type
Description
area
Blurred area
callback
function
layer:AddWithBlurShared(draw.Rect(0, 0, 200, 200), function()
layer:AddText(draw.Vec2(100, 100), "I can't read this either...", draw.Color.White())
end)Name
Type
Description
area
Blurred area
callback
function
layer:AddWithFrost(draw.Rect(0, 0, 200, 200), function()
layer:AddText(draw.Vec2(100, 100), "Chilly", draw.Color.White())
end)B point.
c
C point.
col
Shape color.
Top right point.
br
Bottom right point.
bl
Bottom left point.
col
Shape color.
Shape color.
Circle radius.
c
Shape color.
segments
int
Circle segments. If set to 0, will attempt automatic segment deduction. Defaults to 0.
fill
float
Fill amount (clockwise, 0 to 1). Defaults to 1.
B point.
c
C point.
cols
table[, , ]
Colors for each point. Colors go in the very same order as the parameter list.
Colors for each corner of the rectangle, in clockwise order starting from top-left.
Circle radius.
cols
table[, ]
Colors for the gradient, starting with the inner and ending with the outer color.
segments
int
The number of segments to approximate the circle. Defaults to 36.
fill
float
The portion of the circle to fill, where 1.0 is a full circle. Defaults to 1.0.
Top right point.
br
Bottom right point.
bl
Bottom left point.
cols
table[, ]
Colors for the gradient, applied from bottom to top.
Bottom right point of the pill.
radius_min
float
The minimum radius of the pill's rounded edges.
radius_max
float
The maximum radius of the pill's rounded edges.
cols
table[, ]
Colors for the gradient, applied from bottom to top.
segments
int
The number of segments for approximating rounded edges. Defaults to 16.
Shadow direction.
a
float
Max opacity. Defaults to 0.25.
Shadow distance, in pixels, outwards.
bg
bool
Whether to draw a background for the rectangle. Defaults to true.
a
float
Max opacity of the shadow. Defaults to 0.25.
Glow distance, in pixels, outwards.
c
Glow color.
parts
Parts of the glow to enable. Defaults to ALL.
Fill color.
amount
float
Rounding amount.
rnd
Rounding mode. Defaults to ALL.
Fill colors. Used clockwise, starting from top left.
amount
float
Rounding amount.
rnd
Rounding mode. Defaults to ALL.
Point B.
c
Point C.
col
Line color.
thickness
float
Line thickness. Defaults to 1.0.
mode
Outline mode. Defaults to INSET.
Top-right point.
br
Bottom-right point.
bl
Bottom-left point.
c
Line color.
thickness
float
Line thickness. Defaults to 1.0.
mode
Outline mode. Defaults to INSET.
Line color.
thickness
float
Line thickness. Defaults to 1.0.
mode
Outline mode. Defaults to INSET.
float
Circle radius.
c
Line color.
segments
int
Circle segments. Defaults to 36.
fill
float
Fill amount. Defaults to 1.0.
thickness
float
Line thickness. Defaults to 1.0.
mode
Outline mode. Defaults to INSET.
End point.
c
Line color.
thickness
float
Line thickness. Defaults to 1.0
End point.
c
Start color.
c2
End color.
thickness
float
Line thickness. Defaults to 1.0.
Line color.
amount
float
Rounding amount.
rnd
Rounding mode. Defaults to ALL.
thickness
float
Line thickness. Defaults to 1.0.
mode
Outline mode. Defaults to INSET.
Text.
c
Text color.
params
?
Text aligning parameters. Defaults to nil.
Whether this function should intersect previous rect with the new one. Defaults to true.
Render callback, applies the effect on all render calls inside it
Render callback, applies the effect on all render calls inside it
Render callback, applies the effect on all render calls inside it
This enum determines which flags a font object should possess. Setting those flags is only possible during type construction.
Field
Adds a 1px shadow to font glyphs.
Field
Adds a 1px outline to font glyphs.
Field
Enable antialiasing on font glyphs. This flag only works on GDI fonts.
Field
Disable DPI scaling on this font. By default, font glyphs will be scaled in accordance to the global DPI scale.
Field
Disable glyph kerning on this font.
Field
Enables a strong hinting algorithm for rasterization. Only works on FreeType fonts.
Field
Enables a light hinting algorithm for rasterization. Only works on FreeType fonts.
This enum represents the unique identifier for all player hitgroups. Not to be confused with EHitBox.
Field
Field
Field
Field
Field
Field
Field
Field
Field
Field
Field
Usage:
gui.{func_or_field}
This table exposes the GUI system of the software.
Field
Type:
GUI context.
Field
Type:
Notification system.
Field
Type:
Input context.
Function
Wraps a control into a layout consisting of a label and that specific control. You should add this new control to groupboxes if you want your control to be displayed nicely. Additionally, you can add any extra controls to the returned one - those will get stacked to the left side of your initial control.
Arguments
Returns
Example
Function
A quick wrapper for MakeControl , returns both the menu element and control.
Arguments
Returns
Example
Function
Creates a vertical stack with two or more .
Arguments
Returns
Example
Function
Returns whether or not the menu is currently open.
Returns
Example
Function
Returns the current ragebot/legitbot weapon or category path.
Arguments
None.
Returns
Example
Function
Returns the menu's main window.
Arguments
None.
Returns
Example
Function
Returns list of all controls with hotkeys currently added.
Arguments
None.
Returns
Example
Function
Returns list of all colors being used the GUI theme.
Arguments
None.
Returns
Example
Name
Type
Description
text
string
Label value.
c
Type
Description
Layout object.
local row = gui.MakeControl('Hello checkbox!', my_cb);Name
Type
Description
id
string
ID.
label
string
Type
Description
any
Menu element (checkbox, slider etc.)
Control
local slider, slider_ctrl = gui.MakeControlEasy('my_slider', 'Slider', 'slider', 0, 100);Name
Type
Description
id
|string
ID
size
Type
Description
Group stack object.
local grp1 = gui.Group('grp1', 'My group 1', 150, gui.GroupWidthMode.DEFAULT);
local grp2 = gui.Group('grp2', 'My group 2', 150, gui.GroupWidthMode.DEFAULT);
local stack = gui.MakeStackedGroups("grp12", draw.vec2(234, 400), {
grp1, grp2
});Type
Description
boolean
If menu is visible or not
if gui.IsVisible() then
print('Menu is open!')
endstring
The path currently being used by the ragebot or legitbot
local override_path = gui.GetActiveOverridePath()
local hitchance = gui.ctx:Find(override_path .. '>weapon>hitchance')The window object.
local wnd = gui.GetMainWindow()
local pos = wnd:GetPosAbs()table<>
All controls currently with keybinds set
local controls = gui.GetHotkeyList()
for i, control in ipairs(controls) do
local element = control:Cast() -- Convert to its parent type
if element:GetHotkeyState() then
print('overriding ' .. element:GetLabel().text,
'value ' .. tostring(element:GetValue():Get()))
end
endtable<>
All menu colors
local colors = gui.GetThemeColors()
draw.surface:AddRect(draw.Rect(0, 0, 100, 100), colors.accent)Should only be called when you're alive, causes undefined behavior otherwise.
Control object.
Label value.
type
string
The type of this control
...
any...
Extra constructor arguments
Size
groups
table<>
List of group boxes
checkbox
slider
color_picker
text_input
combo_boxtitle1, title2, accent, accent2, text, textLight, textMid, textDark, bgBottom, bgBlock, bgBlock2, bgBlockSelectedTab, accentOutline, bgBlockLight, bgOdd, bgEven, outline, outlineLight, warning, danger, success, untrustedThis type represents basic user information.
FieldRead only
Type: Texture?
User's avatar. May be nil.
FieldRead only
Type: string
User's username.
Event usertype. An instance of this type can be found in events.
Method
Adds a callback to the event.
Arguments
Returns
Nothing.
Example
Method
Removes a callback from the event.
Arguments
Returns
Nothing.
Example
fn
function
Callback function. Arguments that are accepted by the function are dictated by the event instance.
fn
function
Callback function, that was earlier passed to the add() function.
events.presentQueue:Add(function ()
-- will be called every time game queues a frame for rendering
end);local function on_present()
if some_condition then
events.presentQueue:Remove(on_present)
end
end
events.presentQueue:Add(on_present)In this section, the most common gui types are listed, that are not particularly bound to a specific part of the gui.