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)