Home Blog CS:GO

Onetap V3 Re:Run Documentation: Globals

__filename: string

Filename of the currently running script.

Reference(path: Path): Reference

Returns a Reference to the specified ui element.

Entity(entityindex: number): Entity

Returns the Entity for the specified entity.

Vector2(x: number, y: number): Vector2

Returns a Vector2 with the specified coordinates.

Vector3(x: number, y: number, z: number): Vector3

Returns a Vector3 with the specified coordinates.

Angle(pitch: number, yaw: number, roll: number): Angle

Returns Angle with the specified pitch/yaw/roll values.

RGBA(r: number, g: number, b: number, a: number): RGBA

Returns a RGBA color with the specified red/green/blue/alpha values.

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: function)

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

Cheat.RegisterCallback("CreateMove", function() {
    // called every tick
})

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.

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

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.

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

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.AddCheckbox(name: string): Reference

Creates a checkbox element in the scripting section and returns a reference to it.

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

Creates a slider element with the specified range in the scripting section and returns a reference to it.

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

Creates a slider element with the specified range in the scripting section and returns a reference to it.

UI.AddHotkey(name: string): Reference

Creates a hotkey element in the scripting section and returns a reference to it.

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

UI.AddLabel(text: string): Reference

Creates a label element in the scripting section and returns a reference to it.

UI.AddDropdown(name: string, options): Reference

Creates a dropdown element in the scripting section and returns a reference to it.
options is a list of string.

Reference.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): Reference

Creates a mnlti dropdown element in the scripting section and returns a reference to it.
options is a list of string.

Reference.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): Reference

Creates a colorpicker element in the scripting section and returns a reference to it.

UI.AddTextbox(name: string): Reference

Creates a textbox element in the scripting section and returns a reference to it.

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.

Entities

Entities.GetEntities(): Array[Entity]

Returns the entityindex of every entity.

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

Returns the entityindex of every entity with that class id.

Entities.GetPlayers(): Array[Entity]

Returns the entityindex of every player.

Entities.GetEnemies(): Array[Entity]

Returns the entityindex of every enemy.

Entities.GetTeammates(): Array[Entity]

Returns the entityindex of every teammates.

Entities.GetLocalPlayer(): Entity

Returns the entityindex of yourself.

Entities.GetGameRulesProxy(): Entity

Returns the entityindex of the gamerules proxy.

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

Entities.GetEntityFromUserID(userid: number): Entity

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

Trace

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

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

[target: Entity, fraction: number]

  • target is the entity who 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: Entity, target: Entity, start: Vector3, end: Vector3)

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

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

  • target is the entity 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(): Entity

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

Ragebot.IgnoreTarget(entity: Entity)

Ignores the specified entity for the current tick.

Ragebot.ForceTarget(entity: Entity)

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

Ragebot.ForceTargetSafety(entity: Entity)

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

Ragebot.ForceTargetHitchance(entity: Entity, 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(entity: Entity, 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): Material?

Creates a material and returns it or false if it fails.

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

Material.Get(name: string): Material

Returns the material.