> For the complete documentation index, see [llms.txt](https://gamesensical.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gamesensical.gitbook.io/docs/developers/development/examples/watermark.md).

# Simple watermark

This is a simple text watermark showing the ping, tickrate and windows time. Ingame it looks like this:

![](https://i.imgur.com/73FUdvm.png)

Modify the `flags`, `margin` and `padding` variables to change the appearance. Colors are hardcoded in the 2 drawing function calls, but can be easily modified too.

```lua
-- localize often used API variables to improve performance. It's usually fine to not do this, but lua then has to look them up as globals every time.
local client_latency, client_screen_size, client_system_time, globals_tickinterval, math_floor, renderer_measure_text, renderer_rectangle, renderer_text, string_format = client.latency, client.screen_size, client.system_time, globals.tickinterval, math.floor, renderer.measure_text, renderer.rectangle, renderer.text, string.format

-- this function will be executed every time CS:GO renders a frame and lets you draw on top of the game scene.
local function on_paint()
	-- fetch dynamic info. latency is in seconds so we convert it to ms and round it. tickrate is calculated with 1 / tickinterval
	local screen_width, screen_height = client_screen_size()
	local latency = math_floor(client_latency()*1000+0.5)
	local tickrate = 1/globals_tickinterval()
	local hours, minutes, seconds = client_system_time()

	-- create text
	local text = string_format("%dms", latency) .. " | " .. string_format("%dtick", tickrate) .. " | " .. string_format("%02d:%02d:%02d", hours, minutes, seconds)

	-- modify these to change how the text appears. margin is the distance from the top right corner, padding is the size the background rectangle is larger than the text
	local margin, padding, flags = 18, 4, nil

	-- uncomment this for a "small and capital" style
	-- flags, text = "-", (text:upper():gsub(" ", "   "))

	-- measure text size to properly offset the text from the top right corner
	local text_width, text_height = renderer_measure_text(flags, text)

	-- draw background and text
	renderer_rectangle(screen_width-text_width-margin-padding, margin-padding, text_width+padding*2, text_height+padding*2, 32, 32, 32, 200)
	renderer_text(screen_width-text_width-margin, margin, 235, 235, 235, 255, flags, 0, text)
end
client.set_event_callback("paint", on_paint)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gamesensical.gitbook.io/docs/developers/development/examples/watermark.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
