🔧Installation TextUi
This page explains how to integrate the 'Sweepz_Ui_Elements' script's text ui system into other systems.
File Location: qb-core/client/drawtext.lua
Replace the entire file with the code we provided.
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)File Location: es_extended/client/functions.lua
Line Number: 160
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
endFile Location: ox_lib/resource/interface/client/textui.lua
Replace the entire file with the code we provided.
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)Last updated