Developer LUA Utility Library with Bridges and Common UI Elements

Developer Utility Library with Bridges and Common UI Elements

utils_thumb

Overview


Welcome to boii_utils — your new favorite excuse to never write boilerplate code again.

This all-in-one, modular, feature-stuffed utility library is built specifically for FiveM script developers who are tired of reinventing the wheel every time they touch a new resource.

In v2.0, everything’s been rewritten from the ground up:

  • The bloat? Gone.
  • The bugs? Squashed.
  • The logic? Rewired with duct tape and ambition.
  • The license? MIT, because freedom tastes better without GPL breath.

What you’re getting now is a cleaner, faster, actually organized toolkit designed to make your life easier and your codebase prettier.
Use just what you need, ignore the rest, and regain a little sanity.

Why use boii_utils?


  • Simplifies Scripting: Functions that just work, without needing a 12-tab Stack Overflow deep dive.
  • Prebuilt Systems: Fully modular. Plug in, power up, and pretend you built it from scratch.
  • Reduces Dev Load: Spend less time writing boilerplate and more time watching your players ignore your server rules.

Highlights


Framework & UI Bridges: Making peace treaties between frameworks since inception.

  • Framework Bridge: boii, esx, nd, ox, qb, qbx because commitment issues are real.
  • Notification Bridge: default, boii, esx, okok, ox, qb every flavour of annoying popup you could desire.
  • DrawText Bridge: default, boii, esx, okok, ox, qb for when you really need to make your players read something.

Standalone Systems: Because frameworks shouldn’t hold all the power.

  • Callbacks: For when you’re tired of yelling into the void; now it yells back, politely.
  • Commands: Database-backed permissions included, or switch to Ace if you insist on complicating things.
  • Licences: Comprehensive license system including theory tests, practical tests, points management, and revoking, like your local DMV, minus the soul-crushing lines.
  • XP: Level-up system with growth factors and max levels, because who doesn’t love arbitrary numbers going up?

Unique Scripting Modules: Pre-made shortcuts for the lazy genius in all of us.

  • Characters Module: Enough functions to build character creators, clothing stores, tattoos, everything you need to keep your players staring at themselves for hours.
  • Vehicles Module: If it drives and you can customize it, these functions probably have you covered.

UI Elements: The obligatory flashy bits to trick players into thinking you know what you’re doing.

  • Action Menu: Bored of spinning circles deciding what to click next? Try out a different take.
  • Context Menu: Simple and effective, with header images.
  • Dialogue: NPC conversations without the awkward silence.
  • DrawText: Display on screen text clearly, ensuring players ignore it even faster.
  • Notify: Notification styles for all occasions: success, error, info, warning, primary, secondary, light, dark, critical, neutral.
  • Progress Bar: The classic, comforting sight of incremental loading bars.
  • Progress Circle: Revolutionary innovation… it’s like a progress bar, but circular!

All Modules


  • Framework Bridge: Bridges multiple cores through one api.
  • Notifications Bridge: Bridges multiple different notification resources through one api.
  • DrawText UI Bridge: Bridges multiple different drawtext ui resources through one api.
  • Callbacks: A standalone alternative to framework systems.
  • Characters: Covers all character customisation relevant function with shared styles data.
  • Commands: A standalone alternative to framework systems.
  • Debugging: A couple of useful debugging functions.
  • Entities: Everything related to entities (npc, vehicles, objects) within the game world.
  • Environment: Set of function to cover everything enviroment, from current times to simulated seasons.
  • Geometry: Suite of functions to simplfy geometric calculations in 2d and 3d space.
  • Items: A standalone usable items registry to provide an alternative to framework specific systems.
  • Keys: Includes a full static key list and simple function to get and retrieve keys by name or value.
  • Licences: Full standalone licence system with support for point systems, theory and practical test markers, with support for licence revoking.
  • Maths: Extends base math. functionality with a large suite of additional functions.
  • Methods: Provides a system to register, remove, and trigger custom method callbacks on both the client and server.
  • Player: Small amount of player related functions such as retrieving the players cardinal direction or running animations on the player with full attached prop support.
  • Requests: Set of wrapper functions around cfx Request functions.
  • Strings: Extends base string. functionality by adding some addition functions.
  • Tables: Extends base table. functionality by adding some useful functions otherwise not already provided.
  • Timestamps: Covers everything related to server side timestamps with formatted responses.
  • Vehicles: Large suite of vehicle related functions, should include everything needed to create a vehicle customs resource.
  • Version: Provides resource version checking from an externally hosted .json file.
  • XP: Full standalone XP system with support for types, growth factors and max levels.

UI Screenshots


Menus and DrawText
Progress Bars

Installation


You know the drill.

  1. Drop it in your resources/.
  2. Insert the included REQUIRED.sql into your database.
  3. ensure boii_utils.
  4. Restart your server.

Full setup guide: docs/2-Installation.md.

Dependencies


License

Released under the MIT License.
That means it’s free, open-source, and yours to use, modify, or build on — just don’t remove the license or the credit.

You’re welcome to profit from it, but let’s keep things respectful: don’t act like you wrote it all yourself. :heart:

Contributing


Got code? Great. Got opinions? Even better.

If you’ve written something useful, spotted something broken, or just want eternal internet glory (or shame), submit a pr.
We welcome contributions, improvements, fixes, and clever feature requests.

You can also reach out through Discord if you would prefer.

Notes


  • Currently documentation for the library is limited to the included docs files, these will be moved to gitbook in time however for now it will have to do.

Support


Need help? Found a bug? Need to vent about a bug that isn’t from this library?
Support is available through the BOII Development Discord.

Support Hours: Mon–Fri, 10AM–10PM GMT

Outside those hours? Pray to the debug gods or leave a message.

Links


13 Likes

:heart:

More stuff will be added as our new multi-framework updates progress, if there’s something needed throughout the development of those it will be added into here for future ease of use.

Hopefully should save people a tonne of time once they get used to the library :slight_smile:

2 Likes

Respect. Might give it a go on my next script

1 Like

For sure.

Currently in the process of rebuilding our qb catalogue into new updated resources and utils will be used pretty heavy throughout to speed up this process, along with allowing the new builds to be I guess technically “standalone” since utils will provide the bridge.

It’s speeding up my time anyway so hopefully it speeds up others too :saluting_face:
Any issue let me know and will get on it as soon as possible :heart:

1 Like

qbox support? would be amazing :slight_smile:

1 Like

Sure can do.
I’m not all that familiar with qbox but isn’t it just a “improved” version of qb-core?
Functions and stuff should be mostly the same if so.

Transitioned the release into v1.0.0 since it seems more than stable enough now, and the majority of what is needed for the in house resource updates is done.
(may still be some more to add as the updates progress, of course any suggestions for things to include are still open)

GitHub and Tebex versions of the resource have both been updated.
Docs have also been updated to include some brief information on the new additions.

Update Notes

# V1.0.0

# SERVER
- Connections **new**
-> Added new connections section to handle player connection logic and create a user account to be used in other systems.
- Commands **new**
-> Added new commands sections using user accounts created by new connections logic to handle permission checks
- Commands List **new**
-> Added new commands list section to keep utils commands organised, currently only includes a test command to get the players ID.
- Frameworks
-> Replaced initialization with a thread and slight delay to ensure framework objects are ready before initializing utils.
- Various
-> Replaced all uses of utils.debugging with utils.debug to accurately reflect new debug setup

# CLIENT
- Commands **new**
-> Added new commands section right now it just handles chat suggestions
- Frameworks
-> Replaced initialization with a thread and slight delay to ensure framework objects are ready before initializing utils.
- Various
-> Replaced all uses of utils.debugging with utils.debug to accurately reflect new debug setup

# Shared
- Debug
-> Replaced utils.debugging with shorter version utils.debug
-> Remove utils.debugging.debug; pretty redundant due to the other various options available

Much love folks <3

It does have backwards compactibility, but it would be better if it used qbox functions and modules directly. Some events are changed and PlayerData is as a module, some of their scripts like qbx_management uses exports, instead of events. Personally i only use the core, but seeing support for it would be awesome, as it will most likely have many changes in the future, to the point where support for them will be required. :slight_smile:

Yeh will admit I took a peak at the core again after that reply and noticed it seems to be a lot different now than it was when I first got wind of it.

Leave it with me will get that done for the next update have a couple other things to be added also since I will be starting work on our framework build again at end of the month.

1 Like

Just a note:

Currently working on some additions for v1.1.0 so any suggestions for additional things to include more than happy to try squeeze those in if time permits.

Planning to add some more support for other frameworks out of the box, a decent amount of code clean up, extensive commenting throughout to hopefully help people understand things a little better. Along with a extensive section to cover pretty much everything you could possibly need for creating any scripts related to character creation (character genetics, clothing, tattoos, barber).

New creation section is already tested and working as I am currently re-building the multi-character/creation system for boii_base just simply makes sense to share the work and reduce the load for others :wink:

So another quick update to throw into the mix.
Will make another as soon as possible to improve on the framework bridges with anything else needed and add support for more frameworks, time is just a little limited at the moment.

This update mostly brings a large clean up to the code hopefully to help people understand things just a little better. Have also added in functions to help out with character creation things (e.g, clothing stores, tattoos, character creators etc…).

Have been re-doing the multicharacter / creation process for boii_base (soon to be released) so decided to just put the functions in here save people have to do them :smile:

Below is a screenshot from the new creation process over on the framework build just to show that they do actually work :sweat_smile:

Enjoy :heart:


V1.1.0

# Client

- All Scripts
-> Improved on comments throughout with added use of ldoc tags
- Config
-> Added config.disable section and a toggle to disable framework bridges enabling library to be entirely standalone if required.
-> Added new toggle to disable debug prints for the new character creation section.
- Frameworks
-> Added return to exit framework bridges if disable = true
- Character Creation **NEW**
-> Added a new section to cover pretty much everything people might need to create their own clothing / tattoo / multi-character scripts basically anything involved with character creation is in here.

# Server

- All Scripts
-> Improved on comments throughout with added use of ldoc tags
- Config
-> Added config.disable section and a toggle to disable framework bridges enabling library to be entirely standalone
- Frameworks
-> Added return to exit framework bridges if disable = true

# Shared

- Default Ped Styles **NEW**
-> Added table to manage ped styles for character creation processes.

V1.2.0 has now been pushed!

Resource: boii_utils
Version: 1.2.0
Changes:
# Client

- Notifications
-> Improved conversion for notifications type can now use "info" for all information types and will be converted to type required

# Server

- Frameworks
-> Added function get_player_id to return a player characters identifier e.g. citizen id
-> Added function get_identity_by_id to get a player characters identity from database by their id
- Notifications
-> Fixed mistype with notifications calling TriggerEvent instead of TriggerClientEvent and added missing _src parameter
-> Improved conversion for notifications type can now use "info" for all information types and will be converted to type required
- Conversions
-> Removed testing prints that had been left in
- Version **new**
-> Added section to handle version checking using a github repo json file

# Shared

- Geometry
-> Added function calculate_rotation_matrix
-> Added function translate_point_to_local_space
-> Added function is_point_in_oriented_box

v1.4.0 is now up.

forgot to post for 1.3.0 my bad…

Resource: boii_utils
Version: 1.4.0
Changes: 
-> Moved all files into folders to allow for better future organisation.
-> Added boii dev branding back into top of files.
-> Added new section for handling resource cooldowns.
-> Fixed issue with missing callback to retrieve a singular skills data.
-> Updated debug logs to include name of invoking resource.

Turns out I’m quite bad at this… I also forgot to post for 1.5.0 and 1.6.0 :man_facepalming:

Resource: boii_utils
Version: 1.5.0
Changes: 
-> Added new ui section. This is a section for creating bridges for various UI elements, progress bars, notifications etc.",
-> Added new zones section. This section is for creating zones on the map and checking if players are in them for example safe zones.",
-> Added new update_inventory_data function currently only supported for boii framework will update for others asap.",
-> Added new geometry function line_intersects_circle to check if raycast line intercepts a circular space." 
Resource: boii_utils
Version: 1.6.0
Changes:
-> Moved all utils tables into configs instead of in being at bottom of individual files. Local functions are still assigned here.
-> Removed empty vehicle keys table from server config ideas for this have changed.
-> Modified licence update function to accept table params.
-> Split ui.lua into two files notifications.lua and progressbar.lua.
-> Updated readme file as tebex version was missing a readme.

v1.7.0 is being worked on got another couple things to add that could be useful for others :slight_smile:

v1.70 update

Resource: boii_utils
Version: 1.7.0
Changes:
- Blips
-> Updated notes for some of the functions.

- Frameworks
-> Modified server side get_balance function to return item cash for boii_core if balance_type = cash.
-> Added new callback to allow retrieving players id on client side.

- UI 
-> Corrected fxmanifest load order as progressbar could not access notify.
-> Fixed issue with progressbar bridge notifications

- Groups
-> Added a specified leader option to groups.
-> Modified group setup to allow for having a group image.
-> Added new server functions is_member and is_leader to check if player is member or leader of a group respectively.
-> Added new server function get_groups_of_type to retrieve all groups of a specified type.
-> Added new server function close_group to allow leaders to close a group.
-> Modified add function to now accept a params of player_details when adding players instead of using identity info directly.

- Date & Time
-> Added new function to get time difference in seconds between two timestamps.

Been wildly busy but utils v1.8.0 is here :slight_smile:
Notes for this one are a little long… was a big update… :sweat_smile:

# V 1.8.0

- Restructure to entire code base.
-> Moved files from individual folders to shared 'scripts' folders in respective areas.
-> Moved all 'utils' direct export functions to below each function to keep them close to the functions.
-> Added individual exports for each function where neccessary to remove the need for importing the entire library.

- Shared: Debug
-> Added new functions:
--> log_stack_trace: Logs the current stack trace.
--> dump: Dumps the content of a variable to the log this converts the variable into a JSON string.
--> measure_execution_time: Measures and logs the execution time of a function.
--> log_resource_usage: Logs the current resource usage of the server.
--> try_catch: Moved from general to debug, emulates try-catch behavior in Lua.
--> once: Moved from general to debug, ensures a function is called only once.
--> throttle: Moved from general to debug, throttles function execution.
--> is_number: Moved from general to debug, validates if value is a number.
--> is_table: Moved from general to debug, validates if value is a table.
--> is_string: Moved from general to debug, validates if value is a string.
--> is_function: Moved from general to debug, validates if value is a function.
--> coalesce: Moved from general to debug, returns the first non-nil value from the given arguments.
--> is_empty: Checks if a given value is empty (table or string).
--> debounce: Creates a debounced version of a function.

- Shared: General
-> Moved functions from general to debug: try_catch, once, throttle, is_number, is_table, is_string, is_function, coalesce.
-> Added new functions:
--> hex_to_rgb: Converts a hex value into rgb.
--> generate_uuid: Creates a new UUID, useful for unique identifiers.

- Shared: Keys
-> Added new functions:
--> print_key_list: Prints the list of all keys and their codes.
--> key_exists: Checks if a key exists in the keys table.

- Shared: Maths
-> Added new functions:
--> mean: Calculates the mean (average) of a list of numbers.
--> median: Calculates the median of a list of numbers.
--> mode: Calculates the mode (most frequent value) of a list of numbers.
--> standard_deviation: Calculates the standard deviation of a list of numbers.
--> linear_regression: Calculates the linear regression coefficients (slope and intercept) for a set of points.

- Shared: Networking -- test section! need tables code first.
-> Removed section, has been split into client and server functions respectively. 

- Shared: Strings
-> Added new functions:
--> to_upper:  Converts a string to uppercase.
--> to_lower: Converts a string to lowercase.
--> truncate: Truncates a string to a specified length.
--> repeat_string: Repeats a string a specified number of times.
--> to_title_case: Converts a string to a title case.
--> capitalize_first: Converts the first character of a string to uppercase.
--> remove_char: Removes all occurrences of a specified character from a string.
--> convert_case: Converts a string from one case to another.
--> slugify: Converts a string to a URL-friendly slug.
--> count_words: Counts the number of words in a string.
--> levenshtein: Calculates the Levenshtein distance between two strings.
--> is_palindrome: Checks if a given string is a palindrome.

- Shared: Tables
-> Added new functions:
--> deep_compare: Compares two nested tables.
--> chunk_table: Chunks a table into smaller tables of a specified size.
--> rotate_table: Rotates a table n places.
--> index_of: Returns the index of a value in a table.
--> zip: Zips two tables into a table of pairs.
--> unzip: Unzips a table of pairs into two separate tables.
--> invert: Inverts a table, swapping keys and values.
--> concatenate: Concatenates two tables.

- Client: Blips
-> Added new functions:
--> pulse_blip: Pulses a blip.
--> flash_blip: Flashes a blip for a certain duration.
--> set_blip_route: Set a route to the blip on the minimap.
--> set_blip_priority: Set the priority of a blip.
--> remove_blip_by_label: Remove a blip by its label.

- Client: Commands
-> Added new function get_suggestions for retrieving command chat suggestions when required.

- Client: Config
-> Removed client config entirely now set all settings server side and callback handles sharing to client.

- Client: Environment
-> Added new functions:
--> set_weather: Sets the current weather.
--> set_game_time: Sets the current game time.
--> get_wind_speed: Retrieves the current wind speed.
--> get_wind_direction: Retrieves the current wind direction.
--> set_wind_speed: Sets the wind speed.
--> set_wind_direction: Sets the wind direction.
--> get_sunrise_sunset_times: Retrieves the sunrise and sunset times based on the weather type.
--> is_daytime: Checks if the current time is day or night.
--> get_current_season: Retrieves the current season based on the in-game date.
--> get_environment_details: Retrieves comprehensive environment details including current season, time, weather, sunrise/sunset times, wind direction and speed, etc.
--> get_distance_to_water: Get the distance from the player to the nearest water body.
--> get_water_height_at_coords: Get the water height at a specific location.

- Client: Frameworks
-> Moved into new bridges folder; client/scripts/bridges.
-> Now automatically detects and sets framework so no longer needs to be defined in config.
-> Added new functions: 
--> get_item: Callback to use server side get_item.

- Client: Groups
-> Added new functions:
--> is_leader: Checks if the player is the leader of a specified group.
--> is_member: Checks if the player is a member of a specified group.
--> get_group_members: Fetches all members of the specified group.
--> get_group_members_by_id: Fetches all members of the group the specified player is in.

- Client: Player
-> Added new functions:
--> play_animation: Runs animation on the player with params.
--> is_player_in_water: Checks if the player is in water.
--> get_player_height_from_water: Retrieves the player's height from the nearest water surface.
--> is_player_near_water: Checks if the player is near water.

- Client: UI
-> Removed and moved to client/scripts/bridges, still uses utils.ui functions.

- Client / Server: Notifications
-> Modified notification bridge function to optimise and improve, now auto detects and uses notify resource without specifying.

- Client: Progressbar
-> Refactor and optimised the progress bridge, still need to add additional progress bar resources, now auto detects resource without specifying.

- Client: Vehicles
-> Modified get_vehicle_details now returns is_rear_engine flag for rear engine vehicles, also stores distance from closest vehicle.

- Server: Config
-> Modified rep, skills, and licences table to simplify.

- Server: Licences
-> Adjusted functions to work with new config layout.

- Server: Reputation
-> Adjusted functions to work with new config layout.

- Server: Skills
-> Adjusted functions to work with new config layout.

- Server: Frameworks
-> Moved some functions around to organise the file a little better.
-> Modified inventory related functions to detect boii_inventory or ox_inventory and redirect from framework functions if using resource is started.
-> Updated update_item_data function now covers new qb-inventory and ox_inventory.

- Client: Bridges

-> Added new bridge for drawtext ui covers show and hide drawtext for boii_ui, ox_lib, qb-core, okokTextUI, es_extended.
1 Like