# Installation TextUi

{% tabs %}
{% tab title="QBCore" %}

* File Location: qb-core/client/drawtext.lua
* Replace the entire file with the code we provided.

```lua
local function hideText()
    TriggerEvent("Sweepz_Ui_Elements:CloseTextUi")
end

local function drawText(text, position)
    TriggerEvent("Sweepz_Ui_Elements:OpenTextUi", text, "default", nil, nil)
end

local function changeText(text, position)
    TriggerEvent("Sweepz_Ui_Elements:CloseTextUi")
    Wait(1000)
    TriggerEvent("Sweepz_Ui_Elements:OpenTextUi", text, "default", nil, nil)
end

local function keyPressed()
    TriggerEvent("Sweepz_Ui_Elements:CloseTextUi")
end

RegisterNetEvent('qb-core:client:DrawText', function(text, position)
    drawText(text, position)
end)

RegisterNetEvent('qb-core:client:ChangeText', function(text, position)
    changeText(text, position)
end)

RegisterNetEvent('qb-core:client:HideText', function()
    hideText()
end)

RegisterNetEvent('qb-core:client:KeyPressed', function()
    keyPressed()
end)

exports('DrawText', drawText)
exports('ChangeText', changeText)
exports('HideText', hideText)
exports('KeyPressed', keyPressed)
```

{% endtab %}

{% tab title="ESX" %}

* File Location: es\_extended/client/functions.lua
* Line Number: 160

```lua
function ESX.TextUI(message, typ)
	TriggerEvent("Sweepz_Ui_Elements:OpenTextUi", message, typ, "", "E")
    return true
end

function ESX.HideUI()
	TriggerEvent("Sweepz_Ui_Elements:CloseTextUi")
    return true
end
```

{% endtab %}

{% tab title="Ox\_Lib" %}

* File Location: ox\_lib/resource/interface/client/textui.lua
* Replace the entire file with the code we provided.

```lua
local isOpen = false
local currentText
local currentType

---@param text string
---@param options? TextUIOptions
function lib.showTextUI(text, options)
    if currentText == text then return end

    local typeTU = "default"
    local icon = nil
    local keybind = nil

    if options then
        if options.icon then
            if type(options.icon) == "string" then
                icon = options.icon
            elseif type(options.icon) == "table" then
                icon = options.icon[1]
            end
        end
    end

    TriggerEvent("Sweepz_Ui_Elements:OpenTextUi", text, typeTU, icon, keybind)

    currentText = text
    currentType = typeTU
    isOpen = true
end

function lib.hideTextUI()
    TriggerEvent("Sweepz_Ui_Elements:CloseTextUi")
end

---@return boolean, string | nil
function lib.isTextUIOpen()
    return isOpen, currentText
end

---@return string | nil
function lib.getCurrentTextUIType()
    return currentType
end

RegisterNetEvent("textui:showed", function(text, type)
    currentText = text
    currentType = type
    isOpen = true
end)

RegisterNetEvent("Sweepz_Ui_Elements:CloseTextUi", function()
    isOpen = false
    currentText = nil
    currentType = nil
end)
```

{% endtab %}
{% endtabs %}


---

# 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://sweepz-shop.gitbook.io/docs/scripts/sweepz-ui-elements/installation-textui.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.
