Home Blog CS:GO

Onetap V4 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.ForceCursor(visible: boolean)

This is an alias for Input.ForceCursor, 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())

Globals.FrameStage(): number

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

Globals.ChokedCommands(): number

Returns how many commands have been choked in a row.

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.

Cheat.PrintLog(text: string, color: RGBA?)

Prints text into onetap's log in the top left.

Cheat.IsRageConfigActive(weapon: number): boolean

Returns if the weapon's configuration is active in the ragebot tab.

Note: This takes the weapon's m_iItemDefinitionIndex:

Cheat.IsRageConfigActive(Entity.GetProp(weapon, "CBaseAttributableItem", "m_iItemDefinitionIndex") & 0xFFFF)

Cheat.IsLegitConfigActive(weapon: number): boolean

Returns if the weapon's configuration is active in the legitbot tab.

Note: This takes the weapon's m_iItemDefinitionIndex:

Cheat.IsLegitConfigActive(Entity.GetProp(weapon, "CBaseAttributableItem", "m_iItemDefinitionIndex") & 0xFFFF)

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)

Local.GetCameraPosition(): Vector3

Returns the camera's position.

Local.GetCameraAngles(): Angle

Returns the camera's angles.

Local.SetCameraPosition(position: Vector3)

Sets the camera's position.

Local.SetCameraAngles(angles: Angle)

Sets the camera's angles.

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.

Input.ForceCursor(visible: boolean)

Forces your cursor to be visible or invisible.

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.GetChildren(path: Path): Array[string]

Returns all children of the specified UI element.

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.RegisterCallback(path: Path, name: string)

Registers a callback which will be called everytime the specified UI element's value is changed.

UI.AddCheckbox(path: Path, name: string): Array[string]

Creates a checkbox element at the specified path.
Returns the path to it as a list.

UI.AddSliderInt(path: Path, name: string, min: number, max: number): Array[string]

Creates a slider element with the specified range at the specified path.
Returns the path to it as a list.

UI.AddSliderFloat(path: Path, name: string, min: number, max: number): Array[string]

Creates a slider element with the specified range at the specified path.
Returns the path to it as a list.

UI.AddHotkey(path: Path, name: string, shortname: string?): Array[string]

Creates a hotkey element at the specified path.
shortname is used for displaying in the hitbox state list (optional), use an empty string to hide the hotkey from the list. Returns the path to it as a list.

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

UI.AddDropdown(path: Path, name: string, options: Array[string], searchable: boolean?): Array[string]

Creates a dropdown element at the specified path.
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(path: Path, name: string, options: Array[string]): Array[string]

Creates a mnlti dropdown element at the specified path.
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(path: Path, name: string): Array[string]

Creates a colorpicker element at the specified path.
Returns the path to it as a list.

UI.AddTextbox(path: Path, name: string): Array[string]

Creates a textbox element at the specified path.
Returns the path to it as a list.

UI.AddSubTab(path: Path, name: string): Array[string]

Creates a new subtab at the specified path.
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.SetHotkeyState(path: Path, value: boolean)

Sets the hotkey state of the specified hotkey.

UI.GetHotkeyState(path: Path): boolean

Returns the hotkey state of the specified hotkey.

UI.GetHotkey(path: Path): number

Returns the key the specified hotkey is bound to.

UI.IsMenuOpen(): boolean

Returns if the menu is opened.

UI.GetMenuPosition(): Vector2

Returns the position of the top left corner of the menu.

UI.RemoveItem(path: Path)

Removes the UI element at the specified path.

UI.UpdateList(path: Path, options: Array[string])

Updates the options of a dropdown or multidropdown.

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

Entity.GetCCSWeaponInfo(entityindex: string)

Returns information about the weapon:

Name Type Description
price number weapon price
kill_award number reward for killing an enemy
cycle_time number ---
cycle_time_alt number ---
damage number base damage
armor_ratio number armor penetration
penetration number wall penetration
range number max range before bullets despawn
max_speed number max running speed
max_speed_alt number ---
max_clip number bullets per clip
spread number spread
spread_alt number ---
inaccuracy_crouch number crouching inaccuracy
inaccuracy_crouch_alt number ---
inaccuracy_stand number standing inaccuracy
inaccuracy_stand_alt number ---
inaccuracy_jump_initial number initial jumping inaccuracy
inaccuracy_jump_apex number apex jumping inaccuracy
inaccuracy_jump number jumping inaccuracy
inaccuracy_jump_alt number ---
inaccuracy_land number landing inaccuracy (after jump)
inaccuracy_land_alt number ---
inaccuracy_ladder number ladder inaccuracy
inaccuracy_ladder_alt number ---
inaccuracy_fire number ---
inaccuracy_fire_alt number ---
inaccuracy_move number moving inaccuracy
inaccuracy_move_alt number ---
inaccuracy_reload number ---

Entity.DrawFlag(entityindex: number, label: string, color: RGBA)

Adds a text with the color to the entity's esp.

Entity.DisableESP(entityindex: number)

Prevents the entity from appearing on esp.

Entity.GetSteamID(entityindex: number)

Returns the player's STEAM64 ID.

// TODO: return?

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.RawLine(entityindex: number, start: Vector3, end: Vector3, mask: number, mode: number)

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

  • mask
  • mode has 3 possible values:
    • 0: world and entities
    • 1: world
    • 2: entities

Return is the same as Trace.Line

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!

Trace.Smoke(start: Vector3, end: Vector3): boolean

Returns whether the line goes through a smoke or not.

Warning: Enabling remove smoke, will make this function return false.

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.SetViewAngles(angles: Angle, silent: boolean)

Sets the view angles for the current user command.

UserCMD.SetButtons(value: Buttons)

Sets the buttons for the current user command.

UserCMD.GetButtons(): Buttons

Returns the buttons for the current user command.

UserCMD.SetMouseX(x: number)

Sets the mouse's x position for the current user command.

UserCMD.SetMouseY(y: number)

Sets the mouse's y position for the current user command.

UserCMD.Choke()

Chokes the current user command.

UserCMD.Send()

Unchokes 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.

Exploit.GetNetworkedTickbase(): number

Returns the networked tickbase.

Exploit.GetPredictedTickbase(): number

Returns the predicted tickbase.

Exploit.OverrideTolerance(amount: number)

Overrides the exploit tolerance.

Exploit.OverrideShift(amount: number)

Overrides the amount of shifted ticks.

Exploit.OverrideMaxProcessTicks(amount: number)

Overrides the cheat's limit for shifted ticks.

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.GetTargetHitchance(): number

Returns the chance of hitting the current targetted entitiy.

Ragebot.GetTargets(): Array[number]

Returns all possible ragebot targets.

Ragebot.IgnoreTarget(entityindex: number)

Ignores the specified entity for the current tick.

Ragebot.IgnoreTargetHitbox(entityindex: number, hitbox: Hitbox)

Ignores the specified hitbox of 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.ForceTargetHitboxSafety(entityindex: number, hitbox: Hitbox)

Forces the ragebot to only shoot safepoint for the specified hitbox of 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.

View

View.Create(): number

Creates a new view and returns its index.

View.Update(viewindex: number, width: number, height: number, origin: Vector3, angles: Angle)

Teleports the view to the specified origin looking in the specified direction.
Also sets the resolution of the view to the spcified width and height.

Warning: This can only be called during a FRAME_RENDER_START callback.

View.Render(viewindex: number, x: number, y: number, width: number, height: number

Renders the view at the specified position on your screen with the specified width and height.

Warning: This can only be called during a Draw callback.

View.WorldToScreen(viewindex: number, position: Vector3): Vector2

Like Render.WorldToScreen but from the view's point of view.

DataFile

DataFile.Load(filename: string)

Loads data from a file.

DataFile.Save(filename: string)

Saves the data to the file.

DataFile.SetKey(filename: string, key: string, value: string)

Sets the specified key of the specified file to the specified value.

DataFile.GetKey(filename: string, key: string): string

Returns the value of the specified key of the specified file.

DataFile.EraseKey(filename: string, key: string)

Erases the specified key of the specified file.