Overview

The cheadle_api provides a wide range of Lua functions and tables that allow you to create hooks, draw shapes, manipulate game states, handle input, configure settings, debug, and more. This document outlines each function and table namespace, along with their parameters, return values, and descriptions.

Documentation is still a work in progress. Not all functions and features are thoroughly documented at this time. We are actively working on improving the documentation coverage.


Global Functions

The following functions are accessible directly under the cheadle_api table.


CreateHook

Syntax: cheadle_api.CreateHook(name, func)

  • Parameters:
    • name (string): The name of the hook to create.
    • identifier (string): The identifier of the hook to create.
    • func (function): The Lua function that will be used.
  • Description: Registers a new hook with the specified name and function.

RemoveHook

Syntax: cheadle_api.RemoveHook(name, identifier)

  • Parameters:
    • name (string): The name of the hook.
    • identifier (string): The identifier of the hook.
  • Description: Removes the specified function from the hook with the given name.

DrawRect

Syntax: cheadle_api.DrawRect(x, y, w, h, color, rounding = 0)

  • Parameters:
    • x (number): The X-coordinate of the rectangle’s position.
    • y (number): The Y-coordinate of the rectangle’s position.
    • w (number): The width of the rectangle.
    • h (number): The height of the rectangle.
    • color (table): A table representing the color with fields r, g, b, and optionally a.
    • rounding (number, optional): The rounding radius for the rectangle’s corners (default 0).
  • Description: Draws a filled rectangle at the specified position with the given dimensions and color.

DrawText

Syntax: cheadle_api.DrawText(x, y, text, color, align = 0, font = nil)

  • Parameters:
    • x (number): The X-coordinate where the text will be drawn.
    • y (number): The Y-coordinate where the text will be drawn.
    • text (string): The text string to display.
    • color (table): A table representing the color with fields r, g, b, and optionally a.
    • align (number, optional): Text alignment. Use 0 for left, 1 for center, 2 for right (default 0).
    • font (string, optional): The name of the font to use.
  • Description: Draws text at the specified position with the given color, alignment, and font.

DrawCircle

Syntax: cheadle_api.DrawCircle(x, y, radius, color, filled)

  • Parameters:
    • x (number): The X-coordinate of the circle’s center.
    • y (number): The Y-coordinate of the circle’s center.
    • radius (number): The radius of the circle.
    • color (table): A table representing the color with fields r, g, b, and optionally a.
    • filled (boolean, optional): Whether the circle should be filled (default false).
  • Description: Draws a circle at the specified position with the given radius and color.

DrawLine

Syntax: cheadle_api.DrawLine(x1, y1, x2, y2, color)

  • Parameters:
    • x1 (number): The X-coordinate of the line’s start point.
    • y1 (number): The Y-coordinate of the line’s start point.
    • x2 (number): The X-coordinate of the line’s end point.
    • y2 (number): The Y-coordinate of the line’s end point.
    • color (table): A table representing the color with fields r, g, b, and optionally a.
  • Description: Draws a line between two points with the specified color.

DrawTexture

Syntax: cheadle_api.DrawTexture(texture_name, x, y, w, h)

  • Parameters:
    • texture_name (string): The name or path of the texture file. This is local to %appdata%/cheadleware-v2/data
    • x (number): The X-coordinate where the texture will be drawn.
    • y (number): The Y-coordinate where the texture will be drawn.
    • w (number): The width to draw the texture.
    • h (number): The height to draw the texture.
  • Description: Draws the specified texture at the given position and size.

BuildFont

Syntax: cheadle_api.BuildFont(title, path, size)

  • Parameters:
    • title (string): The name to assign to the font.
    • path (string): The path to the font file.
    • size (number): The size of the font.
  • Description: Creates a font from the specified font file and size, and assigns it the given title.

DrawExtra

Syntax: cheadle_api.DrawExtra(text, color, side, font, ignore_dormant)

  • Parameters:
    • text (string): The text to draw.
    • color (table): A table representing the color with fields r, g, b, and optionally a.
    • side (number): The side to draw the text on. You can use ESP_LEFT, ESP_TOP, ESP_RIGHT, ESP_BOTTOM.
    • font (string, optional): The name of the font to use.
    • ignore_dormant (boolean, optional): Whether to ignore dormant entities (default false).
  • Description: Draws additional text on players or entities during the DrawExtra hook, useful for displaying extra information on ESP.

PushDarkRPVars

Syntax: cheadle_api.PushDarkRPVars()

  • Description: Returns the DarkRPVars table.

getDarkRPVar

Syntax: cheadle_api.getDarkRPVar(ply, var_name)

  • Parameters:
    • ply (Player): The player whose darkRPVar we’re retrieving.
    • var_name (string): The name of the DarkRP variable to retrieve.
  • Returns: The value of the specified DarkRP variable.

InviteFriend

Syntax: cheadle_api.InviteFriend(steamid64)

  • Parameters:
    • steamid64 (string): SteamID64 of the friend.
  • Description: Sends steam invite :steamhappy:

SendAchievement

Syntax: cheadle_api.SendAchievement(achievement_id)

  • Parameters:
    • achievement_id (number): The identifier of the achievement to send.
  • Description: Sends the achievement unlock to the server.

BlockTraceEntity

Syntax: cheadle_api.BlockTraceEntity(entity)

  • Parameters:
    • Entity (Entity): Adds the specified entity to the aimbot entity-skip list.
  • Description: Used in combination with the Aimbot_IgnoreObstacles hook to allow for custom autowall features, ignoring specific entities/players for usages such as ignoring party members.

IsFreecamming

Syntax: cheadle_api.IsFreecamming()

  • Returns: true if the player is currently freecamming, otherwise false.
  • Description: Checks if the player is in freecam mode.

FreecamPos

Syntax: cheadle_api.FreecamPos()

  • Returns: A vector representing the freecam’s position, or nil if not in freecam mode.
  • Description: Retrieves the current position of the freecam.

FreecamAng

Syntax: cheadle_api.FreecamAng()

  • Returns: An angle representing the freecam’s orientation, or nil if not in freecam mode.
  • Description: Retrieves the current angles of the freecam.

GetAimbotTarget

Syntax: cheadle_api.GetAimbotTarget()

  • Returns: The current aimbot target entity, or nil if none.
  • Description: Returns the entity that the aimbot is currently targeting.

GetTeamData

Syntax: cheadle_api.GetTeamData(team_id_or_entity)

  • Parameters:
    • team_id_or_entity (number or Entity): The team number or a player entity.
  • Returns: A table containing the team’s data (name and color).
  • Description: Retrieves data for the specified team or the team of the given entity.

Log

Syntax: cheadle_api.Log(message)

  • Description: Logs the specified message to the console.
  • Parameters:
    • message (string): The message to log.

Syntax: cheadle_api.Log(color, prefix, message)

  • Description: Logs the message to the console with the specified color and prefix.
  • Parameters:
    • color (table): A table with fields r, g, b representing the color.
    • prefix (string): A prefix for the log message.
    • message (string): The message to log.

FindCFunction

Syntax: cheadle_api.FindCFunction(table_name, function_name)

  • Parameters:
    • table_name (string): The name of the table/metatable containing the function (_G: "GLOBAL").
    • function_name (string): The name of the function to find.
  • Returns: The C function if found, otherwise nil.
  • Description: Finds and returns a C function from the specified table.

Notification

Syntax: cheadle_api.Notification(message)

  • Parameters:
    • message (string): The notification message to display.
  • Description: Displays a notification with the specified message on the screen.

RunFile

Syntax: cheadle_api.RunFile(file_path)

  • Parameters:
    • file_path (string): The path to the Lua file to execute. Relative to %appdata%/cheadleware-v2/lua
  • Description: Executes the Lua code from the specified file.

RichPresence

Syntax: cheadle_api.RichPresence(text)

  • Parameters:
    • text (string): The text to set for rich presence
  • Description: Updates your steam rich presence.

IsMenuOpen

Syntax: cheadle_api.IsMenuOpen()

  • Returns: boolean
  • Description: Checks if the Cheadle menu is currently open.

IsKeybindActive

Syntax: cheadle_api.IsKeybindActive(module, feature)

  • Parameters:
    • module (string): The category of the keybind
    • feature (string): The name of the feature
  • Returns: boolean
  • Description: Checks if a keybind is currently active (being held down or toggled).

cheadle_api.Config

The cheadle_api.Config table provides functions to manage and retrieve configuration values, keybinds, colors, and more. module and feature refer to values in your config file. For example: module - “visuals”, feature - “Chams”


EntListSet

  • Parameters:
  • Description: Sets whether an entity class is enabled on the ESP.

GetBool


GetColor


GetFloat


GetInt


GetKeybind


GetString


GetFriendStatus

  • Parameters:
  • Returns: number 0 - Neutral, 1 - Friend, 2 - Enemy

SetBool


SetColor


SetFloat


SetInt


SetKeybind

-- IT USES WINDOWS VIRTUAL KEY CODES, NOT BUTTONCODE_T FROM SOURCE ENGINE
-- https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
cheadle_api.SetKeybind("exploits", "Speedhack Key", { key = 0x48 --[[ 0x48 = H ]] })

SetString


SetFriendStatus

  • Parameters:
    • ent (Entity)
    • value (number): 0 - Neutral, 1 - Friend, 2 - Enemy

cheadle_api.Input

The cheadle_api.Input table provides functions to simulate user input actions.


ButtonDown

Syntax: cheadle_api.Input.ButtonDown(button_code)

  • Parameters:
    • button_code (number): The code of the button to press down.
  • Description: Simulates pressing down the specified button.

ButtonUp

Syntax: cheadle_api.Input.ButtonUp(button_code)

  • Parameters:
    • button_code (number): The code of the button to release.
  • Description: Simulates releasing the specified button.

MouseClick

Syntax: cheadle_api.Input.MouseClick(button)

  • Parameters:
    • button (number): The mouse button to click (e.g., 0 for left, 1 for right).
  • Description: Simulates a mouse click with the specified button.

ButtonClick

Syntax: cheadle_api.Input.ButtonClick(button_code)

  • Parameters:
    • button_code (number): The code of the button to click.
  • Description: Simulates a button click (press and release) of the specified button.

ButtonToVirtual

Syntax: cheadle_api.Input.ButtonToVirtual(button_code)

  • Parameters:
    • button_code (number): Source Engine button code
  • Description: Translates Source’s button codes to Windows virtual key codes.

VirtualToButton

Syntax: cheadle_api.Input.VirtualToButton(virtual_key_code)

  • Parameters:
    • virtual_key_code (number): Windows virtual key code
  • Description: Translates Windows virtual key codes to Source’s button codes.

cheadle_api.debug

The cheadle_api.debug table provides debugging functions.


cheadle_api.GlobalVars

The cheadle_api.GlobalVars table provides access to the game’s global variables.


GetAbsoluteFrametime

Syntax: cheadle_api.GlobalVars.GetAbsoluteFrametime()


GetCurtime

Syntax: cheadle_api.GlobalVars.GetCurtime()


GetFramecount

Syntax: cheadle_api.GlobalVars.GetFramecount()


GetFrametime

Syntax: cheadle_api.GlobalVars.GetFrametime()


GetInterpolationAmount

Syntax: cheadle_api.GlobalVars.GetInterpolationAmount()


GetIntervalPerTick

Syntax: cheadle_api.GlobalVars.GetIntervalPerTick()


GetMaxClients

Syntax: cheadle_api.GlobalVars.GetMaxClients()


GetNetworkProtocol

Syntax: cheadle_api.GlobalVars.GetNetworkProtocol()


GetRealtime

Syntax: cheadle_api.GlobalVars.GetRealtime()


GetSimTicksThisFrame

Syntax: cheadle_api.GlobalVars.GetSimTicksThisFrame()


GetTickcount

Syntax: cheadle_api.GlobalVars.GetTickcount()


SetAbsoluteFrametime

Syntax: cheadle_api.GlobalVars.SetAbsoluteFrametime(time)

  • Parameters:
    • time (number): The absolute frame time to set

SetCurtime

Syntax: cheadle_api.GlobalVars.SetCurtime(time)

  • Parameters:
    • time (number): The current time to set

SetFramecount

Syntax: cheadle_api.GlobalVars.SetFramecount(count)

  • Parameters:
    • count (number): The frame count to set

SetFrametime

Syntax: cheadle_api.GlobalVars.SetFrametime(time)

  • Parameters:
    • time (number): The frame time to set

SetInterpolationAmount

Syntax: cheadle_api.GlobalVars.SetInterpolationAmount(amount)

  • Parameters:
    • amount (number): The interpolation amount to set

SetIntervalPerTick

Syntax: cheadle_api.GlobalVars.SetIntervalPerTick(interval)

  • Parameters:
    • interval (number): The tick interval to set

SetMaxClients

Syntax: cheadle_api.GlobalVars.SetMaxClients(max)

  • Parameters:
    • max (number): The maximum number of clients to set

SetNetworkProtocol

Syntax: cheadle_api.GlobalVars.SetNetworkProtocol(protocol)

  • Parameters:
    • protocol (number): The network protocol version to set

SetRealtime

Syntax: cheadle_api.GlobalVars.SetRealtime(time)

  • Parameters:
    • time (number): The real time to set

SetSimTicksThisFrame

Syntax: cheadle_api.GlobalVars.SetSimTicksThisFrame(ticks)

  • Parameters:
    • ticks (number): The number of simulation ticks to set

SetTickcount

Syntax: cheadle_api.GlobalVars.SetTickcount(count)

  • Parameters:
    • count (number): The tick count to set

cheadle_api.channel

The cheadle_api.channel table provides network channel functions, allowing to manipulate it or read data.


GetAddress

Syntax: cheadle_api.channel.GetAddress()

  • Returns: string
  • Description: Returns the remote IP address and port of the network channel.

GetAvgChoke

Syntax: cheadle_api.channel.GetAvgChoke(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns the average choke percentage for the specified flow.

GetAvgData

Syntax: cheadle_api.channel.GetAvgData(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns the average data flow rate in bytes per second.

GetAvgLatency

Syntax: cheadle_api.channel.GetAvgLatency(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns the average latency (ping) in seconds.

GetAvgLoss

Syntax: cheadle_api.channel.GetAvgLoss(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns the average packet loss percentage.

GetAvgPackets

Syntax: cheadle_api.channel.GetAvgPackets(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns the average packets per second.

GetBSendPacket

Syntax: cheadle_api.channel.GetBSendPacket()

  • Returns: boolean
  • Description: Returns whether packets are currently being sent.

GetBufferSize

Syntax: cheadle_api.channel.GetBufferSize()

  • Returns: number
  • Description: Returns the current network buffer size in bytes.

GetCommandInterpolationAmount

Syntax: cheadle_api.channel.GetCommandInterpolationAmount()

  • Returns: number
  • Description: Returns the command interpolation amount.

GetDataRate

Syntax: cheadle_api.channel.GetDataRate()

  • Returns: number
  • Description: Returns the current data rate in bytes per second.

GetLatency

Syntax: cheadle_api.channel.GetLatency(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns the current latency (ping) in seconds.

GetName

Syntax: cheadle_api.channel.GetName()

  • Returns: string
  • Description: Returns the name of the network channel.

GetPacketTime

Syntax: cheadle_api.channel.GetPacketTime()

  • Returns: number
  • Description: Returns the time since the last packet was received.

GetRate

Syntax: cheadle_api.channel.GetRate()

  • Returns: number
  • Description: Returns the current network rate in bytes per second.

GetSequenceNr

Syntax: cheadle_api.channel.GetSequenceNr()

  • Returns: number
  • Description: Returns the current sequence number.

GetTime

Syntax: cheadle_api.channel.GetTime()

  • Returns: number
  • Description: Returns the current channel time in seconds.

GetTimeConnected

Syntax: cheadle_api.channel.GetTimeConnected()

  • Returns: number
  • Description: Returns how long the channel has been connected in seconds.

GetTimeSinceLastReceived

Syntax: cheadle_api.channel.GetTimeSinceLastReceived()

  • Returns: number
  • Description: Returns time since last packet was received in seconds.

GetTimeoutSeconds

Syntax: cheadle_api.channel.GetTimeoutSeconds()

  • Returns: number
  • Description: Returns the timeout threshold in seconds.

GetTotalData

Syntax: cheadle_api.channel.GetTotalData(flow)

  • Parameters:
    • flow (number): Flow direction (0 for outgoing, 1 for incoming)
  • Returns: number
  • Description: Returns total data transferred in bytes.

IsLoopback

Syntax: cheadle_api.channel.IsLoopback()

  • Returns: boolean
  • Description: Returns whether this is a loopback channel (localhost).

IsPlayback

Syntax: cheadle_api.channel.IsPlayback()

  • Returns: boolean
  • Description: Returns whether this channel is in playback mode.

IsTimingOut

Syntax: cheadle_api.channel.IsTimingOut()

  • Returns: boolean
  • Description: Returns whether the channel is currently timing out.

IsValidPacket

Syntax: cheadle_api.channel.IsValidPacket()

  • Returns: boolean
  • Description: Returns whether the last received packet was valid.

SendDatagram

Syntax: cheadle_api.channel.SendDatagram()

  • Description: Forces sending of a new datagram immediately.

SendNetStringCmd

Syntax: cheadle_api.channel.SendNetStringCmd(cmd)

  • Parameters:
    • cmd (string): Command string to send
  • Description: Sends a net string command through the channel.

SetBSendPacket

Syntax: cheadle_api.channel.SetBSendPacket(value)

  • Parameters:
    • value (boolean): Whether to enable packet sending
  • Description: Sets whether packets should be sent through this channel.

SetCVar

Syntax: cheadle_api.channel.SetCVar(name, value)

  • Parameters:
    • name (string): Name of the ConVar
    • value (string): Value to set
  • Description: Sets a ConVar value through the network channel.

SetRate

Syntax: cheadle_api.channel.SetRate(value)

  • Parameters:
    • value (number): New rate in bytes per second
  • Description: Sets the network rate for this channel.

SetSequenceNr

Syntax: cheadle_api.channel.SetSequenceNr(value)

  • Parameters:

    • value (number): New sequence number
  • Description: Sets the sequence number for the current channel.


cheadle_api.player

The cheadle_api.player table provides functions to access player-related information.


GetAimPunch

Syntax: cheadle_api.player.GetAimPunch(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: A vector representing the aim punch angle
  • Description: Gets the current aim punch angle of the player

GetAmmo

Syntax: cheadle_api.player.GetAmmo(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: A table containing the player’s ammo counts
  • Description: Gets the current ammo counts for all ammo types

GetAnimState

Syntax: cheadle_api.player.GetAnimState(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: The player’s animation state object
  • Description: Gets the current animation state of the player

GetBaseVelocity

Syntax: cheadle_api.player.GetBaseVelocity(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: A vector representing the base velocity
  • Description: Gets the player’s base velocity vector

GetBool/GetInt/GetFloat

Syntax: cheadle_api.player.Get<Type>(entity, var_name)

  • Parameters:
    • entity (Entity): The player entity
    • var_name (string): Name of the networked variable
  • Returns: The value of the specified type
  • Description: Gets a networked variable value of the specified type

GetDuckJumpTime/GetDucktime

Syntax: cheadle_api.player.GetDuck<Type>(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Time value related to ducking
  • Description: Gets timing information about the player’s duck state

GetEyeYaw

Syntax: cheadle_api.player.GetEyeYaw(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: The yaw angle of the player’s eye angles
  • Description: Gets the horizontal eye angle of the player

GetFallVelocity

Syntax: cheadle_api.player.GetFallVelocity(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: The vertical falling speed
  • Description: Gets the player’s current falling velocity

GetFlags

Syntax: cheadle_api.player.GetFlags(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Bitflag containing player states
  • Description: Gets the player’s state flags

GetGroundEntity

Syntax: cheadle_api.player.GetGroundEntity(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: The entity the player is standing on
  • Description: Gets the entity that the player is currently standing on

GetHitboxSet

Syntax: cheadle_api.player.GetHitboxSet(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Current hitbox set index
  • Description: Gets the player’s current hitbox set number

GetMoveType

Syntax: cheadle_api.player.GetMoveType(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Movement type number
  • Description: Gets the player’s current movement type

GetSimulationTime

Syntax: cheadle_api.player.GetSimulationTime(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Current simulation time
  • Description: Gets the player’s simulation time

GetTeamNum

Syntax: cheadle_api.player.GetTeamNum(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Team number
  • Description: Gets the player’s current team number

GetTickBase

Syntax: cheadle_api.player.GetTickBase(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Current tick base
  • Description: Gets the player’s tick base value

GetVelocity

Syntax: cheadle_api.player.GetVelocity(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Vector representing velocity
  • Description: Gets the player’s current velocity vector

GetViewOffset

Syntax: cheadle_api.player.GetViewOffset(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: View offset vector
  • Description: Gets the offset from player origin to view position

GetViewPunch

Syntax: cheadle_api.player.GetViewPunch(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: View punch angle
  • Description: Gets the current view punch angle

HasFlag

Syntax: cheadle_api.player.HasFlag(entity, flag)

  • Parameters:
    • entity (Entity): The player entity
    • flag (number): The flag to check
  • Returns: Boolean indicating if flag is set
  • Description: Checks if the player has a specific flag set

IsDormant

Syntax: cheadle_api.player.IsDormant(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Boolean dormant state
  • Description: Checks if the player entity is dormant

IsDucked/IsDucking/IsInDuckJump

Syntax: cheadle_api.player.Is<DuckState>(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Boolean state
  • Description: Checks various ducking states of the player

ListNetVars

Syntax: cheadle_api.player.ListNetVars(entity)

  • Parameters:
    • entity (Entity): The player entity
  • Returns: Table of networked variables
  • Description: Gets a list of all networked variables on the player

cheadle_api.timer

The cheadle_api.timer table provides functions for timing and scheduling tasks.


Create

Syntax: cheadle_api.timer.Create(name, delay, repetitions, func)

  • Parameters:
    • name (string): Unique identifier for the timer
    • delay (number): Time in seconds between executions
    • repetitions (number): Number of times to repeat (0 for infinite)
    • func (function): Function to execute
  • Description: Creates a new timer that executes the given function after the specified delay

Exists

Syntax: cheadle_api.timer.Exists(name)

  • Parameters:
    • name (string): Name of the timer to check
  • Returns: boolean
  • Description: Checks if a timer with the given name exists

Remove

Syntax: cheadle_api.timer.Remove(name)

  • Parameters:
    • name (string): Name of the timer to remove
  • Description: Removes/stops a timer with the specified name

Simple

Syntax: cheadle_api.timer.Simple(delay, func)

  • Parameters:
    • delay (number): Time in seconds to wait before execution
    • func (function): Function to execute
  • Description: Creates a one-time timer that executes the given function after the specified delay

cheadle_api.File

The cheadle_api.File table provides functions for file operations, including reading and writing files.


Read

Syntax: cheadle_api.File.Read(file_path)

  • Parameters:
    • file_path (string): The path to the file to read. This is relative to %appdata%/cheadleware-v2/data
  • Returns: The contents of the file as a string.
  • Description: Reads the contents of a file at the specified path.

Write

Syntax: cheadle_api.File.Write(file_path, data)

  • Parameters:
    • file_path (string): The path where to write the file. This is relative to %appdata%/cheadleware-v2/data
    • data (string): The data to write to the file.
  • Description: Writes the specified data to a file at the given path.

MakeDir

Syntax: cheadle_api.File.MakeDir(file_path)

  • Parameters:
    • file_path (string): The path to create. This is relative to %appdata%/cheadleware-v2/data
  • Description: Creates a directory with the given name(s).

FindFiles

Syntax: cheadle_api.File.FindFiles(file_path)

  • Parameters:
    • file_path (string): The path where to list files. This is relative to %appdata%/cheadleware-v2/data
  • Description: Lists the files at the given path.

FindDirectories

Syntax: cheadle_api.File.FindDirectories(file_path)

  • Parameters:
    • file_path (string): The path where to list directories. This is relative to %appdata%/cheadleware-v2/data
  • Description: Lists the directories at the given path.

RemoveDir

Syntax: cheadle_api.File.RemoveDir(file_path)

  • Parameters:
    • file_path (string): The path to the directory to remove. This is relative to %appdata%/cheadleware-v2/data
  • Description: Removes the directory with the given path.

Delete

Syntax: cheadle_api.File.Delete(file_path)

  • Parameters:
    • file_path (string): The path to the file to delete. This is relative to %appdata%/cheadleware-v2/data
  • Description: Deletes the file at the specified path.

cheadle_api.ImGui

The cheadle_api.ImGui table provides functions for creating menus and elements in ImGui.


Syntax: cheadle_api.ImGui.Menu(name, window_flags)

  • Parameters:

    • name (string): Name of the Menu.
    • window_flags (number): ImGui Byteflag for Window.
  • Description: Creates an ImGui menu. You can add custom elements to it for custom menus.

  • Example:

local menu = cheadle_api.ImGui.Menu("Example Menu", 0)
menu:SetSize(400, 230)
menu:SetPos(100, 100)

local button = cheadle_api.ImGui.Button(menu, "Close")
button:SetSize(55, 30)
button:SetPos(10, 190)
button:SetClickFunction(function()
  menu:Close()
end)

local checkbox = cheadle_api.ImGui.Checkbox(menu, "sample checkbox")
checkbox:SetPos(10, 35)
checkbox:OnChangeFunction(function()
  cheadle_api.Log("Checkbox toggled: " .. (checkbox:GetChecked() and "true" or "false"))
end)

local dropdown = cheadle_api.ImGui.Dropdown(menu, "sample dropdown", {"option1", "option2"})
dropdown:SetPos(10, 70)
dropdown:OnChangeFunction(function()
  cheadle_api.Log("Dropdown option selected: " .. dropdown:GetSelected())
end)

local slider = cheadle_api.ImGui.Slider(menu, "sample slider", 0, 10)
slider:SetPos(10, 110)
slider:OnChangeFunction(function()
  cheadle_api.Log("Slider changed: " .. slider:GetValue())
end)

local textbox = cheadle_api.ImGui.Textbox(menu, "sample textbox")
textbox:SetPos(10, 150)
textbox:OnChangeFunction(function()
  cheadle_api.Log("Textbox changed: " .. textbox:GetText())
end)
  • Methods:
    • Menu:Close()
    • Menu:SetSize(number width, number height)
    • Menu:SetPos(number x, number y)
    • Menu:ShouldDraw(bool draw)

Checkbox

Syntax: cheadle_api.ImGui.Checkbox(parent, name)

  • Parameters:

    • parent (ImGuiMenu): In which Menu this element should be parented to.
    • name (string): Name of this Checkbox.
  • Description: Creates an ImGui Checkbox.

  • Example:

local menu = cheadle_api.ImGui.Menu("Example Menu", 0)
menu:SetSize(400, 230)
menu:SetPos(100, 100)

local checkbox = cheadle_api.ImGui.Checkbox(menu, "sample checkbox")
checkbox:SetPos(10, 35)
checkbox:OnChangeFunction(function()
  cheadle_api.Log("Checkbox toggled: " .. (checkbox:GetChecked() and "true" or "false"))
end)
  • Methods:
    • Checkbox:GetChecked(): boolean
    • Checkbox:SetChecked(bool checked)
    • Checkbox:SetPos(number x, number y)
    • Checkbox:OnChangeFunction(function callback)

Slider

Syntax: cheadle_api.ImGui.Slider(parent, name, min, max)

  • Parameters:

    • parent (ImGuiMenu): In which Menu this element should be parented to.
    • name (string): Name of this Slider.
    • min (number): Minimum value for this Slider.
    • max (number): Maximum value for this Slider.
  • Description: Creates an ImGui Slider.

  • Example:

local menu = cheadle_api.ImGui.Menu("Example Menu", 0)
menu:SetSize(400, 230)
menu:SetPos(100, 100)

local slider = cheadle_api.ImGui.Slider(menu, "sample slider", 0, 10)
slider:SetPos(10, 35)
slider:OnChangeFunction(function()
  cheadle_api.Log("Slider changed: " .. slider:GetValue())
end)
  • Methods:
    • Slider:GetValue(): number
    • Slider:SetValue(number value)
    • Slider:SetSize(number width, number height)
    • Slider:SetPos(number x, number y)
    • Slider:OnChangeFunction(function callback)

Button

Syntax: cheadle_api.ImGui.Button(parent, name)

  • Parameters:

    • parent (ImGuiMenu): In which Menu this element should be parented to.
    • name (string): Name of this Button.
  • Description: Creates an ImGui Button.

  • Example:

local menu = cheadle_api.ImGui.Menu("Example Menu", 0)
menu:SetSize(400, 230)
menu:SetPos(100, 100)

local button = cheadle_api.ImGui.Button(menu, "sample button")
button:SetSize(130, 25)
button:SetPos(10, 35)
button:SetClickFunction(function()
  cheadle_api.Log("Button clicked")
end)
  • Methods:
    • Button:SetText(string text)
    • Button:SetSize(number width, number height)
    • Button:SetPos(number x, number y)
    • Button:SetClickFunction(function callback)

Syntax: cheadle_api.ImGui.Button(parent, name, options)

  • Parameters:

    • parent (ImGuiMenu): In which Menu this element should be parented to.
    • name (string): Name of this Dropdown.
    • options (table): Options that will be inside of this Dropdown.
  • Description: Creates an ImGui Dropdown.

  • Example:

local menu = cheadle_api.ImGui.Menu("Example Menu", 0)
menu:SetSize(400, 230)
menu:SetPos(100, 100)

local dropdown = cheadle_api.ImGui.Dropdown(menu, "sample dropdown", {"option1", "option2"})
dropdown:SetPos(10, 35)
dropdown:OnChangeFunction(function()
  cheadle_api.Log("Dropdown changed: " .. dropdown:GetSelected())
end)
  • Methods:
    • Dropdown:GetSelected(): string
    • Dropdown:SetSelected(string value)
    • Dropdown:SetSize(number width, number height)
    • Dropdown:SetPos(number x, number y)
    • Dropdown:OnChangeFunction(function callback)

Textbox

Syntax: cheadle_api.ImGui.Textbox(parent, name)

  • Parameters:

    • parent (ImGuiMenu): In which Menu this element should be parented to.
    • name (string): Name of this Textbox.
  • Description: Creates an ImGui Textbox.

  • Example:

local menu = cheadle_api.ImGui.Menu("Example Menu", 0)
menu:SetSize(400, 230)
menu:SetPos(100, 100)

local textbox = cheadle_api.ImGui.Textbox(menu, "sample textbox")
textbox:SetPos(10, 35)
textbox:OnChangeFunction(function()
  cheadle_api.Log("Textbox changed: " .. textbox:GetText())
end)
  • Methods:
    • Textbox:GetText(): string
    • Textbox:SetText(string value)
    • Textbox:SetSize(number width, number height)
    • Textbox:SetPos(number x, number y)
    • Textbox:OnChangeFunction(function callback)

Hooks

The cheadle_api provides a hook system that allows you to listen cheadle’s events. But, they are not limited to only our events, and you can also listen to Garry’s Mod hooks (except for those that were called from Lua)

Post_PreSend

  • Parameters:

  • Description: Called immediately before sending movement packets to the server, in almost all scenarios, use this as a direct replacement to CreateMove if you’d like to override actions performed by other modules. This hook is predicted if prediction is enabled, so be wary of movement changes. Called after silent aim / nospread etc.

  • Example:

cheadle_api.CreateHook("Post_PreSend", "steamhappy", function(cmd)
  -- do magic
end)

Pre_PreSend

  • Parameters:

  • Description: Called immediately before sending movement packets to the server, in almost all scenarios, use this as a direct replacement to CreateMove. This hook is predicted if prediction is enabled, so be wary of movement changes. Called before silent aim / nospread etc.

  • Example:

cheadle_api.CreateHook("Pre_PreSend", "steamhappy", function(cmd)
  -- do magic
end)

Net_Receive

  • Parameters:

  • Description: Called before net.Incoming, allowing for viewing net messages sent from the server before regular lua.

  • Example:

cheadle_api.CreateHook("Net_Receive", "steamhappy", function(message_name)
  -- do magic
end)

Net_ShouldSend

  • Parameters:

  • Description: Called during net.SendToServer. If you return false, the net message will be blocked from sending.

  • Example:

cheadle_api.CreateHook("Net_ShouldSend", "steamhappy", function(msg)
  if msg == "bad_ac_example" then return false end
end)

SendNetMsg

  • Parameters:

  • Description: Called when Source sends network message. Return true to not send this message. (clc_Move, net_Tick, net_StringCmd)

  • Example:

cheadle_api.CreateHook("SendNetMsg", "steamhappy", function(message_name, reliable)
  -- do magic
end)

Aimbot_ShouldTarget

  • Parameters:

  • Description: Allows for overriding whether or not the entity (passed through as a parameter) should be targeted by aimbot. Most useful for ignoring entities for server specific reasons.

  • Example:

cheadle_api.CreateHook("Aimbot_ShouldTarget", "steamhappy", function(ent)
  if cheadle_api.Config.GetFriendStatus(ent) then return false end -- ignore friends in aimbot
end)

Aimbot_IgnoreObstacles

  • Parameters:

  • Description: Allows for adding entities to the aimbot trace filter list.

  • Example:

cheadle_api.CreateHook("Aimbot_IgnoreObstacles", "steamhappy", function()

  local tr = LocalPlayer():GetEyeTrace()
  local ent = tr.Entity
    
  if(ent) then cheadle_api.BlockTraceEntity(ent) end 
  -- ignore whatever entity you're staring at

end)

ESP_ShouldDrawEntity

  • Parameters:

  • Description: Gets called when about to draw an entity. Return false to prevent drawing on the entity.

  • Example:

cheadle_api.CreateHook("ESP_ShouldDrawEntity", "steamhappy", function(ent)
  -- do magic
end)

ESP_ShouldDrawPlayer

  • Parameters:

  • Description: Gets called when about to draw a player. Return false to prevent drawing the player.

  • Example:

cheadle_api.CreateHook("ESP_ShouldDrawPlayer", "steamhappy", function(ent)
  -- do magic
end)

ESP_PlayerName

  • Parameters:

  • Description: Allows for overriding a players name through the value of the return

  • Example:

cheadle_api.CreateHook("ESP_PlayerName", "steamhappy", function(ent)
  return "sigma" -- esp will now show the players name as "sigma"
end)

ESP_PlayerUsergroup

  • Parameters:

  • Description: Allows for overriding a players usergroup through the value of the return

  • Example:

cheadle_api.CreateHook("ESP_PlayerUsergroup", "steamhappy", function(ent)
  return "sigma" -- esp will now show the players usergroup as "sigma"
end)

Entity_DrawExtra

  • Parameters:

  • Description: Gets called after drawing ESP on an Entity.

  • Example:

cheadle_api.CreateHook("Entity_DrawExtra", "steamhappy", function(ent)
  -- draw magic
end)

Player_DrawExtra

  • Parameters:

  • Description: Gets called after drawing ESP on an Player.

  • Example:

cheadle_api.CreateHook("Player_DrawExtra", "steamhappy", function(ent)
  -- draw magic
end)

EngineDrawing

  • Description: Allows for lua to draw in the steam overlay. You can use regular surface functions, both 2d and 3d cams, but you need to start the cams.

  • Example:

local text = "This is in the steam overlay!"

cheadle_api.CreateHook("EngineDrawing", "steamhappy", function()
  cam.Start2D()
    surface.SetFont("DermaLarge")
    local width, height = surface.GetTextSize(text)

    surface.SetTextColor(0, 0, 0)
    surface.SetTextPos(260, 260)
    surface.SetDrawColor(255, 0, 0, 255)
    surface.DrawRect(260, 260, width, height)
    surface.DrawText(text)
  cam.End2D()
end)

Paint

  • Description: Runs every frame on Paint.

  • Example:

cheadle_api.CreateHook("Paint", "steamhappy", function()
  -- draw magic
end)

PaintTraverse

  • Description: Same as Paint hook. Exists for backwards compatibility.

Pre_AnimUpdate

  • Description: Called before animation updates on entities, used for modifying poseparameters, animlayers, etc. for various uses to change how the entity is rendered.

  • Example:

cheadle_api.CreateHook("Pre_AnimUpdate", "steamhappy", function()
  -- draw magic
end)

Key_Change

  • Description: Called when a key is pressed, the first argument is a VK code rather than regular gmod input code. This hook is only called on keys being pressed down or up, and is not called constantly while the key is held.

  • Example:

cheadle_api.CreateHook("Key_Change", "steamhappy", function( key, down )
  cheadle_api.Log(input.GetKeyName(cheadle_api.Input.VirtualToButton(key)) .. " " .. tostring(down))
end)

KeyPressed

  • Description: Called when a key is pressed. The difference between this and Key_Change is this uses the gmod input system.
  • Parameters:
    • button: (KEY)

KeyReleased

  • Description: Called when a key is released. The difference between this and Key_Change is this uses the gmod input system.
  • Parameters:
    • button: (KEY)

PreventKey

  • Description: Called when a key is pressed or released.
  • Parameters:
    • button: (KEY)
  • Returns: true to prevent sending the key press/release to gmod, nil, false or nothing to allow it.

Pre_BuildBones

  • Description: Called before the custom bone creation within the cheat, poseparameters, animlayers, etc. all get reset after this, but it allows for adding resolvers, etc. without modifying their actual model.

  • Examples:

cheadle_api.CreateHook("Pre_BuildBones", "steamhappy", function( ply )
  cheadle_api.Log( ply:Name() )

  local yaw = math.random( -179, 179 )
  local curAngles = ply:GetAngles()

  for i = 0, ply:GetNumPoseParameters() - 1 do
    local min, max = ply:GetPoseParameterRange( i )
    local name = ply:GetPoseParameterName( i )

    cheadle_api.Log( name .. ' ' .. min .. " / " .. max )

    if name == 'aim_yaw' or name == 'head_yaw' then -- make their skeleton TWEAK OUT
      ply:SetPoseParameter( i, yaw )
    end
  end

  ply:SetRenderAngles( Angle( curAngles[1], yaw, curAngles[3] ) )
end)
cheadle_api.CreateHook("Pre_BuildBones", "weird roll resolver", function(ply)
  local eyeAngles = ply:EyeAngles()

  if (eyeAngles[3] == math.abs(180)) then
    ply:SetPoseParameter("aim_pitch", -eyeAngles[1])
    ply:SetRenderAngles(Angle(0, math.NormalizeAngle(eyeAngles[2] - 180), 0))
  end
end)