Notify and HelpText split into seperate modules

Notify and HelpText split into separate modules, settings moved into shared.
This commit is contained in:
MrNewb committed 2025-04-28 10:21:03 -04:00
1 parent 2fd01dd2ae
commit 6e418f406c
20 files changed
+325 -86

No files matched your search

+2
View File
@@ -27,6 +27,7 @@ server_scripts {
'modules/dispatch/**/server.lua',
'modules/clothing/**/server.lua',
'modules/shops/**/server.lua',
'modules/helptext/**/server.lua',
'modules/notify/**/server.lua',
'modules/housing/**/server.lua',
'modules/skills/**/server.lua',
@@ -49,6 +50,7 @@ client_scripts {
'modules/clothing/**/client.lua',
'modules/input/*.lua',
'modules/menu/*.lua',
'modules/helptext/**/client.lua',
'modules/notify/**/client.lua',
'modules/dialogue/**/client/*.lua',
'modules/shops/**/client.lua',
+1
View File
@@ -47,6 +47,7 @@ end
Bridge.RegisterModule("Framework", Framework)
Bridge.RegisterModule("Inventory", Inventory)
Bridge.RegisterModule("Notify", Notify)
Bridge.RegisterModule("HelpText", HelpText)
Bridge.RegisterModule("Clothing", Clothing)
Bridge.RegisterModule("Language", Language)
Bridge.RegisterModule("Doorlock", Doorlock)
+25
View File
@@ -0,0 +1,25 @@
HelpText = HelpText or {}
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return Framework.ShowHelpText(message, _position)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return Framework.HideHelpText()
end
RegisterNetEvent('community_bridge:Client:ShowHelpText', function(message, position)
HelpText.ShowHelpText(message, position)
end)
RegisterNetEvent('community_bridge:Client:HideHelpText', function()
HelpText.HideHelpText()
end)
+17
View File
@@ -0,0 +1,17 @@
HelpText = HelpText or {}
---This will show a help text message to the specified player at the screen position passed
---@param src number
---@param message string
---@param position string
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(src, message, position)
TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position)
end
---This will hide the help text message on the screen for the specified player
---@param src number
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function(src)
TriggerClientEvent('community_bridge:Client:HideHelpText', src)
end
+21
View File
@@ -0,0 +1,21 @@
HelpText = HelpText or {}
local resourceName = "cd_drawtextui"
local configValue = BridgeSharedConfig.HelpText
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return TriggerEvent('cd_drawtextui:ShowUI', 'show', message)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return TriggerEvent('cd_drawtextui:HideUI')
end
+20
View File
@@ -0,0 +1,20 @@
HelpText = HelpText or {}
local resourceName = "jg-textui"
local configValue = BridgeSharedConfig.HelpText
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return exports['jg-textui']:DrawText(message)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports['jg-textui']:HideText()
end
+20
View File
@@ -0,0 +1,20 @@
HelpText = HelpText or {}
local resourceName = "lab-HintUI"
local configValue = BridgeSharedConfig.HelpText
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return exports['lab-HintUI']:Show(message, "Hint Text")
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports['lab-HintUI']:Hide()
end
+20
View File
@@ -0,0 +1,20 @@
HelpText = HelpText or {}
local resourceName = "okokTextUI"
local configValue = BridgeSharedConfig.HelpText
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return exports['okokTextUI']:Open(message, 'darkblue', _position, false)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports['okokTextUI']:Close()
end
+21
View File
@@ -0,0 +1,21 @@
HelpText = HelpText or {}
local resourceName = "ox_lib"
local configValue = BridgeSharedConfig.HelpText
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
if _position == nil then _position = 'left-center' end
return exports.ox_lib:showTextUI(message, { position = _position })
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports.ox_lib:hideTextUI()
end
+22 -80
View File
@@ -1,96 +1,38 @@
Notify = Notify or {}
local notifyType = BridgeClientConfig.NotifySystem
local helptextType = BridgeClientConfig.ShowHelpText
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return "none"
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
if notifyType == 'qb' then
return Framework.Notify(message, nil, time)
elseif notifyType == 'mythic' then
return exports['mythic_notify']:SendAlert('inform', message, time)
elseif notifyType == 'pNotify' then
return exports['pNotify']:SendNotification({ text = message, type = _type, timeout = time, layout = 'centerRight' })
elseif notifyType == 'esx' then
return Framework.Notify(message, _type, time)
elseif notifyType == 'ox' then
return exports.ox_lib:notify({ description = message, type = _type, position = 'center-left' })
elseif notifyType == 'okok' then
return exports['okokNotify']:Alert('Notification', message, time, _type, false)
elseif notifyType == 't-notify' then
return exports['t-notify']:Alert({ style = 'info', message = message, duration = time, })
elseif notifyType == 'wasabi' then
return exports.wasabi_notify:notify(_type, message, time, _type)
elseif notifyType == 'r_notify' then
return exports.r_notify:notify({title = 'Notification', content = message, type = _type, icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
elseif notifyType == 'custom' then
return Prints.Error("You have not set up a custom notify in community_bridge")
else
return Prints.Error("You have not configured a notify in community_bridge")
end
end
---This will show a help text message at the screen position passed
---@param message string
---@param _position string
---@return nil
Notify.ShowHelpText = function(message, _position)
if helptextType == 'ox' then
if _position == nil then _position = 'left-center' end
return exports.ox_lib:showTextUI(message, { position = _position })
elseif helptextType == 'jg' then
return exports['jg-textui']:DrawText(message)
elseif helptextType == 'qb' then
if _position == nil then _position = 'left' end
return Framework.ShowHelpText(message, _position)
elseif helptextType == 'okok' then
if _position == nil then _position = 'left' end
return exports['okokTextUI']:Open(message, 'darkblue', _position, false)
elseif helptextType == 'cd' then
return TriggerEvent('cd_drawtextui:ShowUI', 'show', message)
elseif helptextType == 'lab' then
return exports['lab-HintUI']:Show(message, "Hint Text")
elseif helptextType == 'custom' then
return Prints.Error("You have not set up a custom ShowHelpText in community_bridge")
else
return Prints.Error("You have not configured a ShowHelpText in community_bridge")
end
end
---This will hide the help text message on the screen
---@return nil
Notify.HideHelpText = function()
if helptextType == 'ox' then
return exports.ox_lib:hideTextUI()
elseif helptextType == 'jg' then
return exports['jg-textui']:HideText()
elseif helptextType == 'qb' then
return Framework.HideHelpText()
elseif helptextType == 'okok' then
return exports['okokTextUI']:Close()
elseif helptextType == 'cd' then
return TriggerEvent('cd_drawtextui:HideUI')
elseif helptextType == 'lab' then
return exports['lab-HintUI']:Hide()
elseif helptextType == 'custom' then
return Prints.Error("You have not set up a custom HideHelpText in community_bridge")
else
return Prints.Error("You have not configured a HideHelpText in community_bridge")
end
return Framework.Notify(message, nil, time)
end
RegisterNetEvent('community_bridge:Client:Notify', function(message, _type, time)
Notify.SendNotify(message, _type, time)
end)
RegisterNetEvent('community_bridge:Client:ShowHelpText', function(message, position)
Notify.ShowHelpText(message, position)
end)
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
RegisterNetEvent('community_bridge:Client:HideHelpText', function()
Notify.HideHelpText()
end)
---Depricated: This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.HideHelpText = function()
return HelpText.HideHelpText()
end
---Depricated: This will show a help text message at the screen position passed
---@param message string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.ShowHelpText = function(message, position)
return HelpText.ShowHelpText(message, position)
end
+13 -4
View File
@@ -5,20 +5,29 @@ Notify = Notify or {}
---@param message string
---@param _type string
---@param time number
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(src, message, _type, time)
TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time)
end
---This will show a help text message to the specified player at the screen position passed
---------[[Depricated Stuff Below, please adjust to the HelpText module instead]]--------
---
---
---
---Depricated -- This will show a help text message to the specified player at the screen position passed
---@param src number
---@param message string
---@param position string
---@diagnostic disable-next-line: duplicate-set-field
Notify.ShowHelpText = function(src, message, position)
TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position)
return HelpText.ShowHelpText(src, message, position)
end
---This will hide the help text message on the screen for the specified player
---Depricated -- This will hide the help text message on the screen for the specified player
---@param src number
---@diagnostic disable-next-line: duplicate-set-field
Notify.HideHelpText = function(src)
TriggerClientEvent('community_bridge:Client:HideHelpText', src)
return HelpText.HideHelpText(src)
end
+20
View File
@@ -0,0 +1,20 @@
Notify = Notify or {}
local resourceName = "mythic_notify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['mythic_notify']:SendAlert('inform', message, time)
end
+20
View File
@@ -0,0 +1,20 @@
Notify = Notify or {}
local resourceName = "okokNotify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['okokNotify']:Alert('Notification', message, time, _type, false)
end
+21
View File
@@ -0,0 +1,21 @@
Notify = Notify or {}
local resourceName = "ox_lib"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.ox_lib:notify({ description = message, type = _type, position = 'center-left' })
end
+20
View File
@@ -0,0 +1,20 @@
Notify = Notify or {}
local resourceName = "pNotify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['pNotify']:SendNotification({ text = message, type = _type, timeout = time, layout = 'centerRight' })
end
+20
View File
@@ -0,0 +1,20 @@
Notify = Notify or {}
local resourceName = "r_notify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.r_notify:notify({title = 'Notification', content = message, type = _type, icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
end
+20
View File
@@ -0,0 +1,20 @@
Notify = Notify or {}
local resourceName = "t-notify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['t-notify']:Alert({ style = 'info', message = message, duration = time, })
end
+20
View File
@@ -0,0 +1,20 @@
Notify = Notify or {}
local resourceName = "wasabi_notify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.wasabi_notify:notify(_type, message, time, _type)
end
-2
View File
@@ -1,6 +1,4 @@
BridgeClientConfig = {}
BridgeClientConfig.NotifySystem = "ox" -- [ ox | qb | esx | mythic | pNotify | t-notify | wasabi | lab | custom ]
BridgeClientConfig.ShowHelpText = "ox" -- [ ox | qb | jg | okok | cd | lab | custom ]
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox | qb ]
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | qb-menu ]
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | progressbar ]
+2
View File
@@ -1,6 +1,8 @@
BridgeSharedConfig = {}
BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc)
BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | okokNotify | mythic_notify | pNotify | t-notify | wasabi_notify]
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | cd_drawtextui | lab-HintUI | okokTextUI]
BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone]
BridgeSharedConfig.Skills = "auto" -- [ auto | OT_skills | evolent_skills | pickle_xp]