Commands and Exports — Text UI for FiveM | Quasar Store | Quasar Store
Documentation
Commands and Exports
Every Quasar Text UI client export with parameters and examples: displayTextUI, changeText, hideTextUI, create3DTextUI, update3DTextUI, DeleteDrawText3D, drawText3D and 3D text on players.
Text UI registers no chat or console commands. Prompts are created by your scripts through the exports below, or placed in shared/config.lua — see Usage.
-- displayTextUI(text, key?, align?)
exports['qs-textui']:displayTextUI('Open the garage', 'E', 'center-right')
-- changeText(text, key?) — new text without sliding in again
exports['qs-textui']:changeText('Close the garage', 'E')
exports['qs-textui']:hideTextUI()
Parameter
Default
Meaning
text
—
The text. GTA codes and HTML allowed.
key
Config.DefaultKey
The label on the badge. Display only — your script handles the keypress.
align
Config.DefaultAlign
One of the nine screen positions. An unknown value falls back to the default.
There is one on-screen prompt at a time: a second displayTextUI replaces the first. Show it when the player enters the zone and hide it when they leave — not on every frame:
lua
local garage = vector3(215.8, -810.1, 30.7)
local shown = false
CreateThread(function()whiletruedolocal near = #(GetEntityCoords(PlayerPedId()) - garage) < 3.0if near andnot shown then
exports['qs-textui']:displayTextUI('Open the garage', 'E')
shown = trueelseifnot near and shown then
exports['qs-textui']:hideTextUI()
shown = falseendif near and IsControlJustReleased(0, 38) then-- open your garage hereend
Wait(near and0or500)
endend)
3D text at a coordinate — create3DTextUI, update3DTextUI, DeleteDrawText3D
A prompt floating over a point, with its own distances and an event fired when its key is pressed. Call it once — when your script starts, or when the thing it points at appears — not in a loop.
A display-only label with fixed distances — a marker from 5 m, the text from 2 m — and no keypress of its own: the calling script checks the key itself. Calling it again with the same id moves the label and updates its text, so it is safe to call on every frame. It is what the DrawText3D wrapper uses.
Labels from drawText3D belong to the resource that created them and are removed when it stops. The same call is available as a client event:
lua
3D text on a player — create3DTextUIOnPlayers, DeleteDrawText3DOnPlayers
A prompt that floats over another player and follows them. It takes a second key and a second event, for two actions on the same person:
lua
local promptId = 'cuffed_' .. targetServerId
exports['qs-textui']:create3DTextUIOnPlayers(promptId, {
id = targetServerId, -- server id of the player to follow
displayDist = 6.0,
interactDist = 2.0,
enableKeyClick = true,
key = 'E',
text = 'Search · ~c~[G] Escort',
keyNum = 38,
triggerData = {
triggerName = 'my-police:client:search',
args = { target = targetServerId }
},
keyNum2 = 47,
triggerData2 = {
triggerName = 'my-police:client:escort',
args = { target = targetServerId }
}
})
exports['qs-textui']:DeleteDrawText3DOnPlayers(promptId)
Prompts created through exports live in Text UI's memory. Restarting qs-textui clears them, while the scripts that created them keep running. Either restart those scripts too, or create your prompts again whenever Text UI starts:
Distance at which the text shows and the key works.
key
Yes
The label on the badge — also for a prompt with no key.
text
Yes
The text. GTA codes and HTML allowed.
keyNum
No
Control id of the key (38 = E). Without it, the prompt only informs.
enableKeyClick
No
Leave it true. On a 3D prompt the key is active whenever keyNum is set.
triggerData
No
The event fired on the keypress: triggerName, args (received as one table) and isServer — true sends it to the server instead of the client.
job
No
'all' (default) or a job name. Needs a framework.
canInteract
No
A function. Return false to hide the prompt.
invokingResource
No
A resource name. When that resource stops, the prompt is removed. Pass GetCurrentResourceName().
The event arrives with args as its only parameter:
lua
-- server side, because isServer = true
RegisterNetEvent('my-police:server:toggleDuty', function(args)local src = source
print(src, args.station)
end)
An id that already exists is ignored, so calling create3DTextUI twice with the same id keeps the first. To change anything but the text, delete it and create it again. update3DTextUI changes only the text, and does nothing if the text is the same.
TriggerEvent('textui:DrawText3D', x, y, z, text, id, key)
Field
Meaning
id
Server id of the player the prompt follows.
enableKeyClick
Must be true for either key to work on a player prompt.
keyNum · triggerData
The first key and its event.
keyNum2 · triggerData2
Optional second key and its event.
displayDist · interactDist · key · text
As in create3DTextUI.
The badge shows one key, so mention the second one in the text, as above. Player prompts are not filtered by job — decide who gets one before creating it — and they are not removed when your resource stops, so delete them yourself.