Installation
Install MrPoulpi UI: folder, server.cfg order, demo menu permission and a first in-game test.
Steps
Copy the folder into
resourceswithout renaming it:mrpoulpi_ui. Exports and events carry this name.Add the resource to
server.cfg, after your framework and before the scripts that use it:ensure es_extended ensure mrpoulpi_ui ensure my_garageGrant access to the demo menu to your staff. The
admin,superadminandgodgroups already have it; for another group or a given player:add_ace group.moderator mrpoulpi_ui.menu allowSet at least the language (
Config.Locale) and the companies (Config.Companies.list) inshared/config.lua.Restart the server, or run
ensure mrpoulpi_uiin the console.
First test
In game, open the menu with /uimenu or F7. It tests each element on its own:
| Section | Buttons |
|---|---|
| Notifications | Success, Info, Warning, Error, Announcement, Media |
| Windows | Input, Confirmation, Choice |
| Company | Opening, Closing, Announcement |
| Interface | Hint, Keys (each click shows then hides), Server |
Notification, company and interface buttons keep the menu open so you can chain tests. The Server button checks that an action reaches the server and comes back with a notification.
Using the resource in a script
Nothing to declare: call the exports.
exports.mrpoulpi_ui:Notify('Vehicle stored in the garage', 'success')
exports.mrpoulpi_ui:Notify(source, 'Vehicle stored in the garage', 'success')
To make your scripts start after the resource, add it to the dependencies of their manifest:
dependency 'mrpoulpi_ui'
Replacing framework notifications
To give every server notification this style, redirect your framework’s function.
In es_extended/client/functions.lua:
function ESX.ShowNotification(message, notifyType, length)
exports.mrpoulpi_ui:Notify(message, notifyType, length)
endIn qb-core/client/functions.lua:
function QBCore.Functions.Notify(text, texttype, length)
local message = type(text) == 'table' and text.text or text
exports.mrpoulpi_ui:Notify(message, texttype == 'primary' and 'info' or texttype, length)
endQbox sends its notifications with exports.qbx_core:Notify, which relies on ox_lib. The simplest way is to call exports.mrpoulpi_ui:Notify in your own scripts and leave Qbox notifications as they are.
An unknown type (for example primary) is replaced by Config.Notify.defaultType.
Updating
- Keep a copy of
shared/config.lua,shared/locales.luaand bothhooks.luafiles. - Replace the folder with the new version.
- Carry your changes over. The changelog lists the new options to add to
shared/config.lua.