# textui

## Text UI

<figure><img src="https://share.lvsoft.com.ar/images/oeutw.jpg" alt=""><figcaption></figcaption></figure>

***

### How to use:

Client side using exports

**Example:**

```lua
-- show up the textui
exports.lvs_lib:showTextUI(text, key)

-- update the text and key on the visible textui
exports.lvs_lib:updateTextUI(text, key)

-- effect on the key
exports.lvs_lib:pressedTextUI()

-- hide the textui
exports.lvs_lib:hideTextUI()

-- state of the textui
local isOpen, text = exports.lvs_lib:isOpenTextUI()
```

***

### QBCore Integration:

Replace entire `qb-core/client/drawtext.lua` with:

```lua
local function drawText(text, position)
    exports.lvs_lib:showTextUI(text)
end

local function changeText(text, position)
    exports.lvs_lib:updateTextUI(text)
end

local function keyPressed()
    exports.lvs_lib:pressedTextUI()
end

local function hideText()
    exports.lvs_lib:hideTextUI()
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)
```
