evasivedocs
CS2 scriptingLua 5.4.9 · 25 guides · 292 API entries
Examples

Hello

The smallest useful script. It draws a line of text in the top left corner, and you choose the text in the menu.

Needs: no permission.

Lua
-- @name Hello
-- @description A label in the top left corner.
local label = ui.text_input("Text", "hello from Lua", 32)

events.on("paint", function()
    draw.text(20, 20, label:get(), ui.accent(), { shadow = true })
end)

How it works

  • ui.text_input("Text", "hello from Lua", 32) adds a text field to Scripts > Settings, with a default value and a limit of 32 characters.
  • The paint handler runs every frame and draws whatever the field holds.
  • ui.accent() is the menu's accent colour, so the text follows the user's theme.

Try this

  • Add local size = ui.slider("Size", 10, 40, 16) and pass size = size:get() in the options table.
  • Put the time in front of the text with time.date("%H:%M") .. " " .. label:get().