# misc

Responsible for miscellaneous API features that don't require their own table.


# Functions

# misc.get_username(): string

misc.get_username(): string
  • Retrieves the current username in the cheat.
local username = secret.misc.get_username()
print("Current username:", username) 

# misc.in_screenshot(): boolean

misc.in_screenshot(): boolean
  • Returns true if a screenshot is being captured, otherwise false.
if secret.misc.in_screenshot() then
    print("Warning: Screen capture detected!")
else
    print("No screen capture detected.")
end

# misc.get_freecam_pos(): table

misc.get_freecam_pos(): table
  • Retrieves the current position of the freecam in the world.
local freecam_pos = secret.misc.get_freecam_pos()

if freecam_pos then
    print("Freecam Position:")
    print("X:", freecam_pos.x)
    print("Y:", freecam_pos.y)
    print("Z:", freecam_pos.z)
else
    print("Freecam is not enabled.")
end

# misc.get_freecam_angles(): table

misc.get_freecam_angles(): table
  • Retrieves the current angles of the freecam.

# misc.mouse_event(dwFlags: number, dx: number, dy: number, dwData: number)

misc.mouse_event(dwFlags: number, dx: number, dy: number, dwData: number)
  • Simulates a mouse event by specifying various parameters such as flags, delta x, delta y, and data.
local MOUSEEVENTF_LEFTDOWN = 0x0002 
local MOUSEEVENTF_LEFTUP = 0x0004
secret.misc.mouse_event(MOUSEEVENTF_LEFTDOWN, 100, 100, 0) -- Press left mouse button 
secret.misc.mouse_event(MOUSEEVENTF_LEFTUP, 100, 100, 0) -- Release left mouse button 

# misc.keybd_event(bVk: number, bScan: number, dwFlags: number, dwExtraInfo: number)

misc.keybd_event(bVk: number, bScan: number, dwFlags: number, dwExtraInfo: number)
  • Synthesizes a keystroke. It generates a keystroke down message, a keystroke up message, or a system keystroke.
local VK_A = 0x41
local KEYEVENTF_KEYDOWN = 0x0
local KEYEVENTF_KEYUP = 0x2
secret.misc.keybd_event(VK_A, 0, KEYEVENTF_KEYDOWN, 0) -- Press 'A' key
secret.misc.keybd_event(VK_A, 0, KEYEVENTF_KEYUP, 0) -- Release 'A' key

# misc.add_to_player_esp(index: number, text: string, color: table, position: number)

misc.add_to_player_esp(index: number, text: string, color: table, position: number)
  • Adds an ESP element for a specific player in the game. It allows you to display additional information about the player such as armor, etc.
local DRAW_TOP = 0
local DRAW_BOTTOM = 1
local DRAW_RIGHT = 2
local DRAW_LEFT = 3

secret.listener.add("view_render_post", "Api Example", function()
  for k, v in pairs(player.GetAll()) do
    local index = v:EntIndex()
    secret.misc.add_to_player_esp(index, "Skibidi toilet!", { 255, 255, 255, 255 }, DRAW_TOP)
  end
end)

# misc.add_to_ent_esp(index: number, text: string, color: table, position: number)

misc.add_to_ent_esp(index: number, text: string, color: table, position: number)
  • Adds an ESP element for a specific entity in the game. It allows you to display additional information about the entity.

# misc.get_aimbot_target(): number

misc.get_aimbot_target(): number
  • Returns the current aimbot target index, if the target is not valid, it will return nil.

# misc.setcvar(cvar: string, value: string)

misc.setcvar(cvar: string, value: string)
  • Allows you to set a variable (cvar) to a specified value.

# misc.get_address(): string | false

misc.get_address(): string | false
  • Gets the current address of the server you are connected to.

# misc.is_connected(): boolean

misc.is_connected(): boolean
  • Checks if you are connnected to a server.

# misc.command(cmd: string)

misc.command(cmd: string)
  • Runs a console command in regular string format.

# misc.add_to_entity_list(entity_name: string, action: boolean)

misc.add_to_entity_list(entity_name: string, action: boolean)
  • Adds or removes an entity from the entity list.
  • Note that the entity must already be present in the entity list, which only includes scripted entities.
secret.misc.add_to_entity_list("gmod_hands", true) -- add the entity to ents esp
secret.misc.add_to_entity_list("gmod_hands", false) -- remove the entity from the ents esp

# misc.get_entity_list(): table

misc.get_entity_list(): table
  • Returns a table of all known scripted entities.
  • The keys are entity class names (e.g., "prop_physics"), and the values are booleans indicating whether each entity is currently selected.
local entities = secret.misc.get_entity_list()

for name, selected in pairs(entities) do
    print(string.format("entity: %s | selected: %s", name, tostring(selected)))
end