# 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: 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://docs-csgo.neverlose.cc/useful-information/script-examples/esp.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.
