Home Blog CS:GO

Onetap V3 Documentation: Globals

__filename: string

Filename of the currently running script.

Global

Warning: The usage of this module is discouraged. The Global module is just purely linking to existing functions from other modules and therefore totally unneeded.

Global.Print(text: string)

This is an alias for Cheat.Print, use it instead.

Global.PrintChat(text: string)

This is an alias for Cheat.PrintChat, use it instead.

Global.PrintColor(color: RGBA, text: string)

This is an alias for Cheat.PrintColor, use it instead.

Global.RegisterCallback(callback: string, fn: string)

This is an alias for Cheat.RegisterCallback, use it instead.

Global.ExecuteCommand(command: string)

This is an alias for Cheat.ExecuteCommand, use it instead.

Global.FrameStage(): number

This is an alias for Cheat.FrameStage, use it instead.

Global.Tickcount(): number

This is an alias for Globals.Tickcount, use it instead.

Global.Tickrate(): number

This is an alias for Globals.Tickrate, use it instead.

Global.TickInterval(): number

This is an alias for Globals.TickInterval, use it instead.

Global.Curtime(): number

This is an alias for Globals.Curtime, use it instead.

Global.Realtime(): number

This is an alias for Globals.Realtime, use it instead.

Global.Frametime(): number

This is an alias for Globals.Frametime, use it instead.

Global.Latency(): number

This is an alias for Local.Latency, use it instead.

Global.GetViewAngles(): Angle

This is an alias for Local.GetViewAngles, use it instead.

Global.SetViewAngles(angle: Angle)

This is an alias for Local.SetViewAngles, use it instead.

Global.GetMapName(): string

This is an alias for World.GetMapName, use it instead.

Global.IsKeyPressed(path: Path): boolean

This is an alias for Input.IsKeyPressed, use it instead.

Global.GetScreenSize(): Vector2

This is an alias for Render.GetScreenSize, use it instead.

Global.GetCursorPosition(): Vector2

This is an alias for Input.GetCursorPosition, use it instead.

Global.PlaySound(filename: string)

This is an alias for Sound.Play, use it instead.

Global.PlayMicrophone(filename: string)

This is an alias for Sound.PlayMicrophone, use it instead.

Global.StopMicrophone()

This is an alias for Sound.StopMicrophone, use it instead.

Global.GetUsername(): string

This is an alias for Cheat.GetUsername, use it instead.

Global.SetClanTag(clantag: string)

This is an alias for Local.SetClanTag, use it instead.

Globals

Globals.Tickcount(): number

Returns the tick the server is on.

Globals.Tickrate(): number

Returns the server's tickrate. The tickrate is how many ticks the server processes each second.

Globals.TickInterval(): number

Returns the time between each tick. This is equivalent to: 1 / Globals.Tickrate()

Globals.Curtime(): number

Returns the time of the server in seconds.

Globals.Realtime(): number

Returns the time in seconds since the game started.

Globals.Frametime(): number

Returns the time the last frame took to render. To convert to FPS use:

Math.floor(1 / Globals.Frametime())

Sound

Sound.Play(filename: string)

Plays a sound from a .wav file.

Sound.PlayMicrophone(filename: string)

Plays a sound from a .wav file over the voicechat.

Sound.StopMicrophone()

Interrupts the currently playing sound from Sound.PlayMicrophone.

Cheat

Cheat.GetUsername(): string

Returns the name of the steam account at the point of the injection.

Cheat.RegisterCallback(callback: string, name: string)

Registers a callback, check the Callbacks documentation for more information.

// function name must be declared globally
function onCreateMove() {
    // this gets called every tick
}
Cheat.RegisterCallback("CreateMove", "onCreateMove") // use the function NAME as string

Cheat.ExecuteCommand(command: string)

Executes a command in the CS:GO console.

// TODO: better example :kek:
Cheat.ExecuteCommand("say I'm using OTC (chams.cc)") // cringe

Cheat.FrameStage(): number

Returns the current framestage.

Stage Meaning
0 Frame Start
1 Frame NetUpdate Start
2 Frame NetUpdate PostDataUpdate Start
3 Frame NetUpdate PostDataUpdate End
4 Frame NetUpdate End
5 Frame Render Start
6 Frame Render End

Cheat.Print(text: string)

Prints text into the CS:GO console.
A newline \n is not automatically appended, so make sure you include one.

Cheat.PrintChat(text: string)

Prints text into your local chat (only you can see it).

You can use special bytes to change the color:

Byte Color Byte Color Byte Color Byte Color
\x01 White \x05 Lighter green \x09 Gold \x0D Dark purple
\x02 Dark red \x06 Light green \x0A Gray \x0E Light purple
\x03 Purple \x07 Red \x0B Aqua \x0F Light red
\x04 Green \x08 Gray \x0C Blue

Warning: The first character cannot be a color changing byte, adding a space at the start of the string fixes this issue.

Cheat.PrintColor(color: RGBA, text: string)

Same as Cheat.Print but colored.

Local

Local.Latency(): number

Returns your latency to the server in seconds.

Local.GetViewAngles(): Angle

Returns your current viweangles.

function onDraw() {
    const angles = Global.GetViewAngles();
    Render.String(5, 5, 0, "Angles: pitch=" + angles[0] + " yaw=" + angles[1] + " roll=" + angles[2], [255, 0, 0, 255]);
}
Global.RegisterCallback("Draw", "onDraw");

Local.SetViewAngles(angle: Angle)

Sets your current viewangles to the specified one.

Local.SetClanTag(clantag: string)

Changes your clantag to the specified one.

Local.GetRealYaw(): number

Returns the yaw of your real.

Local.GetFakeYaw(): number

Returns the yaw of your fake.

Local.GetSpread(): number

Returns the spread of your selected gun.

Local.GetInaccuracy(): number

Returns the inaccuracy of your selected gun with other factors calculated (e.g. moving inaccuracy)

World

World.GetMapName(): string

Returns the current map name. (e.g. de_dust2, de_mirage)

World.GetServerString(): string

Returns the current server (ip, port, offline match, ...) as a string.
This is used in the watermark.

Input

Input.GetCursorPosition(): Vector2

Returns the current position of the cursor (mouse).

Input.IsKeyPressed(key: number): boolean

Returns if the key is currently pressed.

For possible keys check Virtual Key Codes.

Render

Note: Can only be used during a Draw callback.

Render.String(x: number, y: number, align: number, text: string, color: RGBA, size: Size)

Renders the string text at the position x|y on the screen.

align === 0 is left-aligned and everything else is centered.
size is optional.

// this will render a red colored string at the top left of the screen
Render.String(0, 0, 0, "Hello World", [255, 0, 0, 255]); 

Render.TextSize(text: string, size: Size): Vector2

Returns width and height the text would need to be rendered.

Render.Line(x1: number, y1: number, x2: number, y2: number, color: RGBA)

Renders a line from x1|y1 to x2|y2.

Render.Rect(x: number, y: number, width: number, height: number, color: RGBA)

Renders the outline of a rectangle at x|y with the specified width and height.

Render.FilledRect(x: number, y: number, width: number, height: number, color: RGBA)

Renders a filled reactangle at x|y with the specified width and height.

Render.GradientRect(x: number, y: number, width: number, height: number, direction: number, color1: RGBA?, color2: RGBA?)

Renders a gradient reactangle at x|y with the specified width and height.

Render.Circle(x: number, y: number, radius: number, color: RGBA)

Renders a circle at x|y with the specified color and radius.

Render.FilledCircle(x: number, y: number, radius: number, color: RGBA)

Renders a circle at x|y with the specified color and radius.

Render.Polygon(points, color: RGBA)

Renders a polygon/triangle, the 3 corners are the points list.

function onDraw() {
    // draws a simple red polygon
    Render.Polygon([[50, 0], [25, 50], [75, 50]], [255, 0, 0, 255]);
}
Cheat.RegisterCallback("Draw", "onDraw");

Render.WorldToScreen(position: Vector3): Vector2

Transforms a world position to a screen position.

Render.AddFont(name: string, size: number, weight: number): number

Creates a new font with the specified name, size and weight, and returns its font identifier.

Render.FindFont(name: string, size: number, weight: number): number

Returns font identifier.
Returns 0 if the font is not found.

Render.StringCustom(x: number, y: number, align: number, text: string, color: RGBA, font: number)

Renders the string text at x|y with a custom font (see also Font).

Render.TexturedRect(x, y, width, height, texture)

Renders the texture at x|y with the specified width and height.

Render.AddTexture(filename: string): number

Returns a texture loaded from a file.

Render.TextSizeCustom(text: string, font: number): Vector2

Like Render.TextSize but for custom fonts.

Render.GetScreenSize(): Vector2

Returns the width and height of the screen (not the CS:GO window!).

UI

UI.GetValue(path: Path)

Returns the value of the specified UI element.

function getFakelag() {
    if(!UI.GetValue("Anti-Aim", "Fake-Lag", "Enabled"))
        return 0;  // fakelag disabled
    return UI.GetValue("Anti-Aim", "Fake-Lag", "Limit");
}

UI.SetValue(path: Path, value)

Sets the value of the specified UI element.

function disableFakeLag() {
    UI.SetValue("Anti-Aim", "Fake-Lag", "Enabled", false);
}
function toggleFakeLag() {
    var fakelag_enabled = UI.GetValue("Anti-Aim", "Fake-Lag", "Enabled");
    UI.SetValue("Anti-Aim", "Fake-Lag", "Enabled", !fakelag_enabled);
}

UI.AddCheckbox(name: string)

Creates a checkbox element in the scripting section.
Returns the path to it as a list.

UI.AddSliderInt(name: string, min: number, max: number)

Creates a slider element with the specified range in the scripting section.
Returns the path to it as a list.

UI.AddSliderFloat(name: string, min: number, max: number)

Creates a slider element with the specified range in the scripting section.
Returns the path to it as a list.

UI.AddHotkey(name: string)

Creates a hotkey element in the scripting section.
Returns the path to it as a list.

Use UI.IsHotkeyActive to check if the hotkey is active.

UI.AddLabel(text: string)

Creates a label element in the scripting section.

UI.AddDropdown(name: string, options)

Creates a dropdown element in the scripting section.
options is a list of string.
Returns the path to it as a list.

UI.GetValue on a dropdown returns a zero-indexed number

UI.AddDropdown("sample dropdown", ["option 0", "option 1", "option 2"])

// by default the first option is selected
UI.GetValue("sample dropdown") // 0
UI.SetValue("sample dropdown", 2) // sets dropdown to "option 2"

UI.AddMultiDropdown(name: string, options)

Creates a mnlti dropdown element in the scripting section.
options is a list of string.
Returns the path to it as a list.

UI.GetValue on a dropdown returns a number which has the bits of the active options set.

UI.AddMultiDropdown("sample multidropdown", ["option 0", "option 1", "option 2"])

UI.GetValue("sample multidropdown") // 0, because nothing is set
UI.SetValue("sample multidropdown", 0b101) // selects option 0 and 2 (bitwise)
UI.GetValue("sample multidropdown") // 5, because option 0 and 2 are set

UI.AddColorPicker(name: string)

Creates a colorpicker element in the scripting section.
Returns the path to it as a list.

UI.AddTextbox(name: string)

Creates a textbox element in the scripting section.
Returns the path to it as a list.

UI.SetEnabled(path: Path, value: boolean)

Enables/disables the checkbox at the specified path.

UI.GetString(path: Path): string

Returns the string in the textbox at the specified path.

UI.GetColor(path: Path): RGBA

Returns the selected color from the colorpicker at the specified path.

UI.SetColor(path: Path, color: RGBA)

Sets the color at the specified path to the specified color.

UI.IsHotkeyActive(path: Path): boolean

Returns whether the hotkey at the specified path is active or not.

UI.ToggleHotkey(path: Path): number

Toggles the hotkey at the specified path.
Returns the new active state. (0 = inactive, 1 = active)

UI.IsMenuOpen(): boolean

Returns if the menu is opened.

Convar

Convar.GetInt(name: string): number

Returns the current value of the specified console variable.

Convar.SetInt(name: string, value: number)

Sets the value of the specified console variable to the specified value.

Convar.GetFloat(name: string): number

Returns the current value of the specified console variable.

Convar.SetFloat(name: string, value: number)

Sets the value of the specified console variable to the specified value.

Convar.GetString(name: string): string

Returns the current value of the specified console variable.

Convar.SetString(name: string, value: string)

Sets the value of the specified console variable to the specified value.

Event

Note: Can only used during a Callbacks.

Event.GetInt(name: string): number

Returns the integer representation of the specified variable.

Event.GetFloat(name: string): number

Returns the floating point representation of the specified variable.

Event.GetString(name: string): string

Returns the string representation of the specified variable.

Entity

Entity.GetEntities(): Array[number]

Returns the entityindex of every entity.

Entity.GetEntitiesByClassID(classid: number): Array[number]

Returns the entityindex of every entity with that class id.

Entity.GetPlayers(): Array[number]

Returns the entityindex of every player.

Entity.GetEnemies(): Array[number]

Returns the entityindex of every enemy.

Entity.GetTeammates(): Array[number]

Returns the entityindex of every teammates.

Entity.GetLocalPlayer(): number

Returns the entityindex of yourself.

Entity.GetGameRulesProxy(): number

Returns the entityindex of the gamerules proxy.

// TODO: maybe link to some information about the GameRulesProxy?

Entity.GetEntityFromUserID(userid: number): number

Returns the entityindex of the player with the matching user id.

Entity.IsTeammate(entityindex: number): boolean

Returns if the entity is a teammate.

Entity.IsEnemy(entityindex: number): boolean

Returns if the entity is an enemy.

Entity.IsBot(entityindex: number): boolean

Returns if the entity is a bot.

Entity.IsLocalPlayer(entityindex: number): boolean

Returns if the entity is yourself.

Entity.IsValid(entityindex: number): boolean

Returns if the entity is valid (e.g. exists, player is still connected, ...).

Entity.IsAlive(entityindex: number): boolean

Returns if the entity is alive.

Entity.IsDormant(entityindex: number): boolean

Returns if the entity is dormant.

Entity.GetClassID(entityindex: number): number

Returns the class id of the entity.

NOTE: Class ids sometimes change during game updates, and shouldn't be used for identification.
Use Entity.GetClassName instead.

Entity.GetClassName(entityindex: number): string

Returns the name of the class the entity belongs to.

Entity.GetName(entityindex: number): string

Returns the display name of the entitiy.

NOTE: Do not use this to differentiate between items, because this language dependent.
Doing so, will make your script only work in a specific game language.

Entity.GetWeapon(entityindex: number): number

Returns the current held weapon's entityindex by the entity.

var lp = Entity.GetLocalPlayer();
if(Entity.IsAlive(lp)) {
    var weapon = Entity.GetWeapon(lp);
    Cheat.Print("holding: " + Entity.GetClassName(weapon));
}

Entity.GetWeapons(entityindex: number): Array[number]

Returns the entityindex of every weapon the entity has (primary weapon, pistol, knife, zeus, grenades, ...)

Entity.GetRenderOrigin(entityindex: number): Vector3

Returns position of the entity.

Entity.GetRenderBox(entityindex: number)

Returns the render box of the entity as an array:

[visible: boolean, min_x: number, min_y: number, max_x: number, max_y: number]

Entity.GetProp(entityindex: number, table: string, propname: string)

Returns the value of the specified prop.

table will be the entity's classname most of the time (CCSPlayer for players).

Entity.SetProp(entityindex: number, table: string, propname: string, value)

Sets the specified prop to the specified value.

table will be the entity's classname most of the time (CCSPlayer for players).

Entity.GetHitboxPosition(entityindex: number, bone: Bone): Vector3

Returns the position of the bone.

Entity.GetEyePosition(entityindex: number): Vector3

Returns the position of the "eye" of the entity (the place where bullets come from).

Trace

Trace.Line(entityindex: number, start: Vector3, end: Vector3)

Traces a line between start and end, ignoring the specified entity.

[target: number, fraction: number]

  • target is the entityindex of what was hit
  • fraction has 3 possible values:
    • 1.0: didn't hit anything
    • 0.5: hit something halfway through
    • 0.1: hit something

Trace.Bullet(source: number, target: number, start: Vector3, end: Vector3)

Traces a bullet between start and end.
Returns undefined if the target is not hit.

[target: number, damage: number, visibility: boolean, hitbox: number]

  • target is the entityindex from the function call
  • damage is the damage your current gun would deal
  • visibility is whether the target is visible
  • hitbox is the hitbox that gets hit, see also: Hitbox

Warning: If you've teamcheck on, this will return 0 damage on teammates and yourself!

UserCMD

NOTE: This can only be used during a CreateMove callback.

UserCMD.SetMovement(movement: Vector3)

Sets the movement for the current user command.

UserCMD.GetMovement(): Vector3

Returns the planned movement for the current user command.

UserCMD.SetAngles(angles: Vector3)

Sets the viewangles for the current user command.

UserCMD.ForceJump(value: boolean)

Forces yourself to jump (or not) in this user command.

UserCMD.ForceCrouch(value: boolean)

Forces yourself to crouch (or not) in this user command.

AntiAim

AntiAim.GetOverride(): number

Returns whether the antiaim is being managed by a script.
1 means it is and 0 means it isn't.

AntiAim.SetOverride(managed: number)

Enables/disables management of the antiaim.

Warning: A boolean is not supported.
Use 0 instead of false and 1 instead of true.

AntiAim.SetRealOffset(degrees: number)

Sets the offset of your real (relative to your AntiAim.SetFakeOffset).
Degrees should be between -58 and 58.

AntiAim.SetFakeOffset(degrees: number)

Sets your yaw offset (relative to -180).
Degrees should be between -180 and 180.

AntiAim.SetLBYOffset(degrees: number)

Sets the offset of your fake (relative to your AntiAim.SetFakeOffset).
Degrees should be between -58 and 58.

Exploit

Exploit.GetCharge(): number

Returns the current doubletap charge percentage between 0 and 1 and -1 if disabled.

Exploit.Recharge()

Forces the ragebot to recharge the doubletap as soon as possible.

Exploit.DisableRecharge()

Disables automatic recharge.

Exploit.EnableRecharge()

Enables automatic recharge.

Ragebot

Note: Can only be used during a CreateMove callback.

Ragebot.GetTarget(): number

Returns the entityindex of the targetted entity.
Returns 0 if no entity is being targetted.

Ragebot.IgnoreTarget(entityindex: number)

Ignores the specified entity for the current tick.

Ragebot.ForceTarget(entityindex: number)

Forces the ragebot to shoot the specified entity for the current tick.

Ragebot.ForceTargetSafety(entityindex: number)

Forces the ragebot to only shoot safepoint for the specified entity for the current tick.

Ragebot.ForceTargetHitchance(entityindex: number, hitchance: number)

Forces the ragebot to only shoot with at least the specified hitchance for the specified entity for the current tick.
Hitchance is a number between 0 and 100.

Ragebot.ForceTargetMinimumDamage(entityindex: number, damage: number)

Forces the ragebot to shoot for at least the specified damage for the specified entity for the current tick.
Damage 0 is treated as dynamic min damage. Damage over 100 is treated as HP + (damage - 100).

Ragebot.ForceHitboxSafety(hitbox: Hitbox)

Forces the ragebot to only shoot safepoint of the specified hitbox for the current tick.

Material

Useful ressources:

Material.Create(name: string): boolean

Creates a material and returns if the creation was successful.

The material is added to the "Visible type" dropdown in the chams section of the menu.

Material.Destroy(name: string): boolean

Destroys a material and returns if the destruction was successful.

Material.Get(name: string): number

Returns the materialindex of the material.
The materialindex may change between callback execution, so don't store the index.

Note: Can only be called during a Material callback.

Material.SetKeyValue(materialindex: number, key: string, value: string)

Overrides value of the material.

Note: Can only be called during a Material callback.

Material.Refresh(materialindex: number)

Refreshes the material with the new values set using Material.SetKeyValue.

Note: Can only be called during a Material callback.