This is a new and improved UI resource that is more customizable then my old resource rr_notify. And it also does not only create notification, you can also draw text that stays on the screen until you disable it.
If you want this resource to be plug and play please download the newst version from releases. The code here is the source code and should only be used for development purposes
This script currently has 2 ui components.
- Notify | Notifications
- DrawText
The notifications come with a wide variaty of options so you can change everything to your liking.
The simple notifcation handles the style and icons for you by default. This is a way simpler way of sending messages that needs less arguments. If you need something more customizable then I recommend going for the normal message function
Through exports:
Clientsided
-- msgType: string
-- -options: success, error, warning, primary, default
-- msg: string
-- useSound | optional: boolean
exports.rr_uilib:NotifyS(msgType, msg, useSound)
Serversided
-- source: number
-- msgType: string
-- -options: success, error, warning, primary, default
-- msg: string
-- useSound | optional: boolean
exports.rr_uilib:NotifyS(source, msgType, msg, useSound)
Through event:
-- source: number
-- msgType: string
-- -options: success, error, warning, primary, default
-- msg: string
-- useSound | optional: boolean
TriggerClientEvent("rr_uilib:NotifyS", source, msgType, msg, useSound)
Through exports:
Clientsided
exports.rr_uilib:Notify(data)
Serversided
exports.rr_uilib:Notify(source, data)
Through event:
TriggerClientEvent("rr_uilib:Notify", source, data)
The properties are send through the data object. This data object can contain the following options:
Message
local data = {
msg = "This is a test message" -- Required
}
Style The default option is a white background with the icon colored
local data = {
style = "default"
}
Options: "default", "dark", "colored"
Type As you can see on the images above, all the types are displayed. The order of the options below is the same as visible on the images. This will give you an idea how the different types look.
local data = {
type = "default"
}
Options: "success", "error", "primary", "default", "warning
Icon The icon uses the fontawesome 6.0.0 free icons. You just have to add the classes of the icon you want into the icon option.
local data = {
icon = "fa-solid fa-vial"
}
Position
local data = {
position = "top-right"
}
Options: "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"
Duration
local data = {
duration = 1000 -- Time in milliseconds
}
Sound You can import your .mp3 files into the web/public/sounds path. To retrieve them, simply enter the file name in the sound field as in the example below.Instead the volume field is used to set the sound volume.
local data = {
sound = "soundName",
volume = 0.1 -- Optional / Default 0.5
}
Options: "success", "info", "error"
Through exports:
exports.rr_uilib:DrawText(data)
Through event:
TriggerClientEvent("rr_uilib:DrawText", source, data)
Message
local data = {
msg = "This is a test message" -- Required
}
Draw
local data = {
draw = true -- Required
}
If you want to disable the text you have drawn you can simply do that by triggering the DrawText function and just sending data.draw as false.
Like this
exports.rr_uilib:DrawText({draw = false})
Position
local data = {
position = "top-right"
}
Options: "top-left", "top-middle", "top-right", "bottom-left", "bottom-middle", "bottom-right", "center-left", "center-middle", "center-right"
Style
local data = {
style = "transparant"
}
Options: "white", "dark", "transparant"
Transparant
White
Dark
I hope this resource will be helpfull. If you have any question on how to use it please join my support discord so that I can help you.
rr_uilib Copyright (c) 2022 RoleplayRevisited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.