πŸ–ŠοΈ
onecrack
  • Onecrack
  • onecrack api
    • Autostop
    • UserCMD
    • Exploit
    • Globals
    • General
    • GrenadePrediction
    • UI
    • Entity
    • Render
    • Convar
    • Event
    • Trace
    • Sound
    • Local
    • Cheat
    • Input
    • World
    • AntiAim
    • Ragebot
    • Material
    • View
    • DataFile
Powered by GitBook
On this page
  • GetFont
  • TextSize
  • String
  • FilledCircle
  • TexturedRect
  • AddTexture
  • Polygon
  • GradientRect
  • GetScreenSize
  • WorldToScreen
  • Circle
  • FilledRect
  • Rect
  • Line

Was this helpful?

  1. onecrack api

Render

GetFont

Parameters: name, size, is_windows_font

Render.GetFont(name, size, is_windows_font);

Return values: returns font identifier

[EN] Used to add custom font. [RU] Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ для добавлСния собствСнного ΡˆΡ€ΠΈΡ„Ρ‚Π°.

TextSize

Parameters: text, font

Render.TextSize( text, font )

Return values: width, height

[EN] Finds the text size of the given string and font. [RU] Находит Ρ€Π°Π·ΠΌΠ΅Ρ€ тСкста для Π·Π°Π΄Π°Π½Π½ΠΎΠΉ строки ΠΈ ΡˆΡ€ΠΈΡ„Ρ‚Π°.

String

Parameters: x, y, centered, text, color, font

Rendering text now always requires a custom font you make yourself!

function main()
{
    var font = Render.GetFont( "Arial.ttf", 15, true)
    Render.String(100,200,0, "TEST", [255,0,255,255], font)
}
Cheat.RegisterCallback("Draw", "main")

[EN] Draws a string with the given position, align, RGBA color and font. [RU] РисуСт строку с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, Π²Ρ‹Ρ€Π°Π²Π½ΠΈΠ²Π°Π½ΠΈΠ΅ΠΌ, Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA ΠΈ ΡˆΡ€ΠΈΡ„Ρ‚ΠΎΠΌ.

FilledCircle

Parameters: x, y, r, color

That all render functions must be called from within "Draw" callback and that rendering only supports ASCII character table.

function drawCircle()
{
   Render.FilledCircle( 150, 150, 50, [ 255, 255, 255, 255 ] );
}

Cheat.RegisterCallback("Draw", "drawCircle")
// This function will draw filled circle on screen.

Return values: returns true on success or false on failure.

[EN] Draws a filled circle with the given position, radius, and RGBA color. [RU] РисуСт Π·Π°ΠΏΠΎΠ»Π½Π΅Π½Π½Ρ‹ΠΉ ΠΊΡ€ΡƒΠ³ с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, радиусом ΠΈ Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA.

TexturedRect

Parameters: x, y, width, height, texture identifier

function drawTexture()
{
    forumBG = Render.AddTexture("ot/scripts/forumclr.png");
    Render.TexturedRect( 300, 300, 100, 100, forumBG );
}
Cheat.RegisterCallback("Draw", "drawTexture");

Return values: returns true on success or false on failure.

[EN] Draws a textured rectangle with the given position, size, and texture. [RU] РисуСт тСкстурированный ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠΌ ΠΈ тСкстурой.

AddTexture

Parameters: path

- Path is relative to CSGO folder, so you don't need full path. - Supports the following formats:

  • .bmp

  • .dds

  • .dib

  • .hdr

  • .jpg

  • .pfm

  • .png

  • .ppm

  • .tga

function drawTexture()
{
    forumBG = Render.AddTexture("ot/scripts/forumclr.png");
    Render.TexturedRect( 300, 300, 100, 100, forumBG );
}
Cheat.RegisterCallback("Draw", "drawTexture");

Return values: returns texture identifier.

[EN] Adds a texture. [RU] ДобавляСт тСкстуру.

Polygon

Parameters: array of 3 screen positions, color

function drawPolygon()
{
    Render.Polygon( [ [ 10.0, 200.0 ], [ 100.0, 10.0 ], [ 200.0, 160.0 ] ], [ 255, 0, 0, 255 ] );
}
Cheat.RegisterCallback("Draw", "drawPolygon");

[EN] Draws a polygon with shape based on arguments passed. [RU] РисуСт ΠΌΠ½ΠΎΠ³ΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ с Ρ„ΠΎΡ€ΠΌΠΎΠΉ Π½Π° основС ΠΏΠ΅Ρ€Π΅Π΄Π°Π½Π½Ρ‹Ρ… Π°Ρ€Π³ΡƒΠΌΠ΅Π½Ρ‚ΠΎΠ².

GradientRect

Parameters: x, y, w, h, dir, [ col1 ], [ col2 ]

Dir argument stands for direction and 0 is vertical while 1 is horizontal

function drawGradient()
{

    Render.GradientRect( 100, 100, 100, 100, 0, [ 255, 0, 0, 255 ], [ 255, 255, 255, 255 ]);
    Render.GradientRect( 210, 100, 100, 100, 1, [ 255, 0, 0, 255 ], [ 255, 255, 255, 255 ]);
}
Cheat.RegisterCallback("Draw", "drawGradient")

Return values: returns true on success or false on failure.

[EN] Draws a gradient rectangle with the given position, size, and RGBA color. [RU] РисуСт ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ Π³Ρ€Π°Π΄ΠΈΠ΅Π½Ρ‚Π° с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠΌ ΠΈ Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA.

GetScreenSize

function getScreenSize()
{
    var screen_size = Render.GetScreenSize();
    Cheat.Print( "Width of screen is: " + screen_size[0] + "\n");
    Cheat.Print( "Height of screen is: " + screen_size[1] + "\n");
}
Cheat.RegisterCallback("Draw", "getScreenSize")
// This function will print your screen height and width in in-game console.

[EN] Returns width and height of your screen. [RU] Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ ΡˆΠΈΡ€ΠΈΠ½Ρƒ ΠΈ высоту вашСго экрана.

WorldToScreen

Parameters: [x, y, z]

The third array object will be 1 if the world position is in front of you, 0 if it is behind you.

Please note that all render functions must be called from within "Draw" callback.

function drawDuckAmount( )
{
    players = Entity.GetEnemies( );

    for ( i = 0; i < players.length; i++ )
    {
      if ( Entity.IsAlive( players[i] ) )
      {
        world = Entity.GetRenderOrigin( players[i] );

        screen_bot = Render.WorldToScreen( world );

        duckamount = Entity.GetProp( players[i], "DT_BasePlayer", "m_flDuckAmount" );
    
        world_top = world;
        world_top[2] = world_top[2] + ( 64 * ( 1 - duckamount ) );

        screen_top = Render.WorldToScreen( world_top );
      
        if ( screen_bot[2] == 1 && screen_top[2] == 1 )
        {
            Render.Line( screen_bot[0], screen_bot[1], screen_top[0], screen_top[1], [ 0, 0, 255, 255 ] );
        }
    }
  }
}
Cheat.RegisterCallback("Draw", "drawDuckAmount");
// This script will draw a line on enemy players which represents their duck amount.

Return values: returns the value of the parameter or false.

[EN] Finds the world position for the given screen position. [RU] Находит ΠΌΠΈΡ€ΠΎΠ²ΡƒΡŽ ΠΏΠΎΠ·ΠΈΡ†ΠΈΡŽ для Π΄Π°Π½Π½ΠΎΠΉ ΠΏΠΎΠ·ΠΈΡ†ΠΈΠΈ Π½Π° экранС.

Circle

Parameters: x, y, r, color

Please note that all render functions must be called from within "Draw" callback and that rendering only supports ASCII character table.

function drawCircle()
{
   Render.Circle( 150, 150, 50, [ 255, 255, 255, 255 ] );
}

Cheat.RegisterCallback("Draw", "drawCircle")
// This function will draw a circle on screen.

Return values: returns true on success or false on failure.

[EN] Draws a circle with the given position, radius, and RGBA color. [RU] РисуСт ΠΊΡ€ΡƒΠ³ с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, радиусом ΠΈ Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA.

FilledRect

Parameters: x, y, width, height, color

Please note that all render functions must be called from within "Draw" callback and that rendering only supports ASCII character table.

function drawFilledRect()
{
Render.FilledRect( 100, 100, 150, 150, [ 255, 0, 0, 180 ] );
}

Cheat.RegisterCallback("Draw", "drawFilledRect")
// This function will draw a filled rectangle on screen.

Return values: returns true on success or false on failure.

[EN] Draws a filled rectangle with the given position, size, and RGBA color. [RU] РисуСт Π·Π°ΠΏΠΎΠ»Π½Π΅Π½Π½Ρ‹ΠΉ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠΌ ΠΈ Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA.

Rect

Parameters: x, y, width, height, color

Please note that all render functions must be called from within "Draw" callback and that rendering only supports ASCII character table.

function drawRect()
{
Render.Rect( 100, 100, 150, 150, [ 255, 0, 0, 255 ] );
}

Cheat.RegisterCallback("Draw", "drawRect")
// This function will draw a rectangle on screen.

Return values: returns true on success or false on failure.

[EN] Draws a rectangle with the given position, size, and RGBA color. [RU] РисуСт ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌΠΈ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ΠΌ, Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠΌ ΠΈ Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA.

Line

Parameters: x, y, x1, y1, color

Please note that all render functions must be called from within "Draw" callback and that rendering only supports ASCII character table.

function drawLine()
{
Render.Line( 100, 200, 300, 200, [ 255, 0, 0, 255 ] );
}

Cheat.RegisterCallback("Draw", "drawLine")
// This function will draw a line on your screen.

Return values: Returns true on success or false on failure.

[EN] Draws a line with the given position RGBA color. [RU] РисуСт линию с Π·Π°Π΄Π°Π½Π½Ρ‹ΠΌ Ρ†Π²Π΅Ρ‚ΠΎΠΌ RGBA ΠΏΠΎΠ·ΠΈΡ†ΠΈΠΈ.

PreviousEntityNextConvar

Last updated 3 years ago

Was this helpful?