A unified system for managing multiple drawtext resources.
Each supported resource is organized into a table of handlers, with functions for show and hide operations.
This approach enables easy integration and switching between resources.
Developers can simply extend the handlers table to add support for additional resources if required.
Handlers
Table of handlers for drawtext resources.
Covered by default: boii_ui, ox_lib, qb-core, es_extended, okokTextUi
Used to show the chosen drawtext ui, if handler is missing or not provided will default to boii_ui
Function
localfunctionshow_drawtext(options)ifnot options ornot options.message thendebug_log('err', 'Invalid drawtext data provided.')returnendlocal handler = handlers[DRAWTEXT] or handlers['boii_ui'] handler.show(options)endexports('show_drawtext', show_drawtext)utils.ui.show_drawtext = show_drawtext
Example
--- Utils objectutils.ui.show_drawtext({ header ='Test Drawtext', message ='Just another test..', icon ='fa-solid fa-gear'})--- Direct exportexports.boii_utils:show_drawtext(...)
hide_drawtext
Used to hide the current shown drawtext ui.
Function
localfunctionhide_drawtext()local handler = handlers[DRAWTEXT] or handlers['boii_ui'] handler.hide()endexports('hide_drawtext', hide_drawtext)utils.ui.hide_drawtext = hide_drawtext
Example
--- Utils objectutils.ui.hide_drawtext({ header ='Test Drawtext', message ='Just another test..', icon ='fa-solid fa-gear'})--- Direct exportexports.boii_utils:hide_drawtext(...)
Guides
Initial Setup
Currently the utils library requires the UI resources be defined within the config.
This may be moved to resource detection in future however for now it has not been needed.
To set your chosen UI resources head to server/config.lua
Find the following section and pick your choices.
--- UI Bridge settings--- @field drawtext: Specifies the active progressbar system. Options: 'boii_ui', 'qb-core', 'es_extended', 'ox_lib', 'okokTextUI', 'custom'.
--- @field notify: Specifies the active notification system. Options: 'boii_ui', 'qb-core', 'es_extended', 'ox_lib', 'okokNotify', 'custom'.
--- @field progressbar: Specifies the active progressbar system. Options: 'boii_ui', 'custom'.config.ui = { drawtext ='boii_ui', notify ='boii_ui', progressbar ='boii_ui'}
If your desired resource is not already covered by default follow the instructions below on how to add a new handler.
Adding Handlers
To add support for addition resources you need to add a handler into the handlers table inside client/bridges/drawtext.lua