> For the complete documentation index, see [llms.txt](https://docs-csgo.neverlose.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-csgo.neverlose.cc/useful-information/script-examples/esp.md).

# ESP

### Text Example

```lua
local low_health = 20

local text_example = esp.enemy:new_text("Text Example", "LOW HP", function(player)
	local health = player.m_iHealth
	if health > low_health then
		return
	end
	return "LOW HP"
end)

local group_ref = text_example:create()

local slider_ref = group_ref:slider("Low Health", 0, 50, low_health)

slider_ref:set_callback(function(slider_ref)
	low_health = slider_ref:get()
end, true)
```

<figure><img src="/files/Pal2AjfteJQnI7cR6Vk7" alt=""><figcaption></figcaption></figure>

### Bar Example

```lua
local bar_example = esp.enemy:new_bar("Bar Example", function(player)
	local velocity = player.m_vecVelocity
	local speed = velocity:length()
	if speed < 2 then
		return
	end

	local max_speed = 260
	local weapon = player:get_player_weapon()
	if weapon then
		max_speed = weapon:get_max_speed()
	end

	return speed / max_speed * 100
end)
```

### Item Example

```lua
local item_example = esp.enemy:new_item("Item Example")
local item_example_group_ref = item_example:create()
local switch_ref = item_example_group_ref:switch("Switch")

events.render:set(function()
	print(string.format("Item Example Selected: %s", item_example:get()))
	print(string.format("Switch Enabled: %s", switch_ref:get()))
end)
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs-csgo.neverlose.cc/useful-information/script-examples/esp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
