diff --git a/modules/notify/.ox/client.lua b/modules/notify/.ox/client.lua new file mode 100644 index 0000000..7bd0083 --- /dev/null +++ b/modules/notify/.ox/client.lua @@ -0,0 +1,43 @@ +if GetResourceState('ox_lib') ~= 'started' then return end + +Notify = Notify or {} + +local isNotifySystem = (not BridgeClientConfig.NotifySystem) or BridgeClientConfig.NotifySystem == 'auto' or BridgeClientConfig.NotifySystem == 'ox' +local isHelpTextSystem = (not BridgeClientConfig.HelpTextSystem) or BridgeClientConfig.HelpTextSystem == 'auto' or BridgeClientConfig.HelpTextSystem == 'ox' + + + +-- █▄ █ ▄▀▄ ▀█▀ █ █▀ ▀▄▀ ▄▀▀ ▀▄▀ ▄▀▀ ▀█▀ ██▀ █▄ ▄█ +-- █ ▀█ ▀▄▀ █ █ █▀ █ ▄█▀ █ ▄█▀ █ █▄▄ █ ▀ █ +if isHelpTextSystem and not isNotifySystem then goto HELP_TEXT_SYSTEM end +Notify.SendNotify = function(message, type, time) + return exports.ox_lib:notify({ description = message, type = type, position = 'center-left' }) +end + + +-- █▄█ ██▀ █ █▀▄ ▀█▀ ██▀ ▀▄▀ ▀█▀ ▄▀▀ ▀▄▀ ▄▀▀ ▀█▀ ██▀ █▄ ▄█ +-- █ █ █▄▄ █▄▄ █▀ █ █▄▄ █ █ █ ▄█▀ █ ▄█▀ █ █▄▄ █ ▀ █ +if not isHelpTextSystem then return end + ::HELP_TEXT_SYSTEM:: +Notify.ShowHelpText = function(message, _position) + if _position == nil then _position = 'left-center' end + return exports.ox_lib:showTextUI(message, { position = _position }) +end + +Notify.HideHelpText = function() + return exports.ox_lib:hideTextUI() +end + +-- .--------. +-- | taktak | +-- |/-------' +-- .-. ,-. +-- ;oo oo; +-- / \| |/ \ +-- |. `. .' .| +-- `;.;' `;.;' +-- .-^-. .-^-. +-- | | | | | | + + + diff --git a/modules/notify/_default/client.lua b/modules/notify/_default/client.lua new file mode 100644 index 0000000..65585f8 --- /dev/null +++ b/modules/notify/_default/client.lua @@ -0,0 +1,27 @@ +Notify = Notify or {} + +Notify.SendNotify = function(message, type, time) + Utility.NotifyText(message) +end + + +Notify.ShowHelpText = function(message, _position) + Utility.HelpText(message, 7000) +end + +Notify.HideHelpText = function() + +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) + +RegisterNetEvent('community_bridge:Client:HideHelpText', function() + Notify.HideHelpText() +end) \ No newline at end of file diff --git a/modules/notify/server.lua b/modules/notify/_default/server.lua similarity index 100% rename from modules/notify/server.lua rename to modules/notify/_default/server.lua diff --git a/modules/notify/_esx/client.lua b/modules/notify/_esx/client.lua new file mode 100644 index 0000000..5e44def --- /dev/null +++ b/modules/notify/_esx/client.lua @@ -0,0 +1,8 @@ +if GetResourceState('esx') ~= 'started' then return end +if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'esx') then return end + +Notify = Notify or {} + +Notify.SendNotify = function(message, type, time) + return ESX.ShowNotification(message, type, time) +end diff --git a/modules/notify/_qb/client.lua b/modules/notify/_qb/client.lua new file mode 100644 index 0000000..7f09295 --- /dev/null +++ b/modules/notify/_qb/client.lua @@ -0,0 +1,8 @@ +if GetResourceState('qb-core') ~= 'started' then return end +if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'qb') then return end +Notify = Notify or {} + + +Notify.SendNotify = function(message, type, time) + return TriggerEvent('QBCore:Notify', message, 'primary', time) +end \ No newline at end of file diff --git a/modules/notify/client.lua b/modules/notify/client.lua deleted file mode 100644 index 23308ef..0000000 --- a/modules/notify/client.lua +++ /dev/null @@ -1,78 +0,0 @@ -Notify = Notify or {} - -Notify.SendNotify = function(message, type, time) - if BridgeClientConfig == nil or BridgeClientConfig.NotifySystem == nil then return Prints.error("You have not configured a compatable notify in community_bridge") end - local notifyType = BridgeClientConfig.NotifySystem - time = time or 3000 - if notifyType == 'qb' then - return TriggerEvent('QBCore:Notify', message, 'primary', 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 ESX.ShowNotification(message, type, time) - elseif notifyType == 'ox' then - return exports.ox_lib:notify({ description = message, type = type, position = 'center-left' }) - 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 == 'lab' then - return exports['swe-notify']:SendNotification(message, time, type) - 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 - -Notify.ShowHelpText = function(message, _position) - if BridgeClientConfig == nil or BridgeClientConfig.ShowHelpText == nil then return Prints.error("You have not configured a compatable helptext in community_bridge") end - local helptextType = BridgeClientConfig.ShowHelpText - 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 exports['qb-core']:DrawText(message, 'left') - 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 - -Notify.HideHelpText = function() - if BridgeClientConfig == nil or BridgeClientConfig.ShowHelpText == nil then return Prints.error("You have not configured a compatable helptext in community_bridge") end - local helptextType = BridgeClientConfig.ShowHelpText - if helptextType == 'ox' then - return exports.ox_lib:hideTextUI() - elseif helptextType == 'jg' then - return exports['jg-textui']:HideText() - elseif helptextType == 'qb' then - return exports['qb-core']:HideText() - 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 -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) - -RegisterNetEvent('community_bridge:Client:HideHelpText', function() - Notify.HideHelpText() -end) \ No newline at end of file diff --git a/modules/notify/jg/client.lua b/modules/notify/jg/client.lua new file mode 100644 index 0000000..6d00748 --- /dev/null +++ b/modules/notify/jg/client.lua @@ -0,0 +1,11 @@ +if GetResourceState('jg-textui') ~= 'started' then return end +if BridgeClientConfig.HelpTextSystem and (BridgeClientConfig.HelpTextSystem ~= 'auto' and BridgeClientConfig.HelpTextSystem ~= 'jg') then return end +Notify = Notify or {} + +Notify.ShowHelpText = function(message, _position) + return exports['jg-textui']:DrawText(message) +end + +Notify.HideHelpText = function() + return exports['jg-textui']:HideText() +end diff --git a/modules/notify/lab/client.lua b/modules/notify/lab/client.lua new file mode 100644 index 0000000..0e19074 --- /dev/null +++ b/modules/notify/lab/client.lua @@ -0,0 +1,12 @@ +if GetResourceState('lab-HintUI') ~= 'started' then return end +if BridgeClientConfig.HelpTextSystem and (BridgeClientConfig.HelpTextSystem ~= 'auto' and BridgeClientConfig.HelpTextSystem ~= 'lab') then return end + +Notify = Notify or {} + +Notify.ShowHelpText = function(message, _position) + return exports['lab-HintUI']:Show(message, "Hint Text") +end + +Notify.HideHelpText = function() + return exports['lab-HintUI']:Hide() +end diff --git a/modules/notify/mythic/client.lua b/modules/notify/mythic/client.lua new file mode 100644 index 0000000..8c65f7b --- /dev/null +++ b/modules/notify/mythic/client.lua @@ -0,0 +1,8 @@ +if GetResourceState('mythic_notify') ~= 'started' then return end +if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'mythic') then return end + +Notify = Notify or {} + +Notify.SendNotify = function(message, type, time) + return exports['mythic_notify']:SendAlert('inform', message, time) +end diff --git a/modules/notify/p-notify/client.lua b/modules/notify/p-notify/client.lua new file mode 100644 index 0000000..a69c06d --- /dev/null +++ b/modules/notify/p-notify/client.lua @@ -0,0 +1,9 @@ +if GetResourceState('pNotify') ~= 'started' then return end +if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'pNotify') then return end + +Notify = Notify or {} + + +Notify.SendNotify = function(message, type, time) + return exports['pNotify']:SendNotification({ text = message, type = type, timeout = time, layout = 'centerRight' }) +end diff --git a/modules/notify/t-notify/client.lua b/modules/notify/t-notify/client.lua new file mode 100644 index 0000000..14d097c --- /dev/null +++ b/modules/notify/t-notify/client.lua @@ -0,0 +1,8 @@ +if GetResourceState('t-notify') ~= 'started' then return end +if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 't-notify') then return end + +Notify = Notify or {} +Notify.SendNotify = function(message, type, time) + return exports['t-SendNotify']:Alert({ style = 'info', message = message, duration = time }) +end + diff --git a/modules/notify/wasabi/client.lua b/modules/notify/wasabi/client.lua new file mode 100644 index 0000000..df9dc40 --- /dev/null +++ b/modules/notify/wasabi/client.lua @@ -0,0 +1,9 @@ +if GetResourceState('wasabi_notify') ~= 'started' then return end +if BridgeClientConfig.NotifySystem and (BridgeClientConfig.NotifySystem ~= 'auto' and BridgeClientConfig.NotifySystem ~= 'wasabi') then return end + +Notify = Notify or {} +Notify.SendNotify = function(message, type, time) + return exports.wasabi_notify:notify(type, message, time, type) +end + + \ No newline at end of file diff --git a/settings/clientConfig.lua b/settings/clientConfig.lua index 7183189..f977d4c 100644 --- a/settings/clientConfig.lua +++ b/settings/clientConfig.lua @@ -1,6 +1,7 @@ BridgeClientConfig = {} BridgeClientConfig.DebugLevel = 2 -- Debug level, 0 for none, 1 for some, 2 for all data BridgeClientConfig.NotifySystem = "ox" -- [ ox | qb | esx | mythic | pNotify | t-notify | wasabi | lab | custom ] +BridgeClientConfig.HelpTextSystem = "auto" BridgeClientConfig.ShowHelpText = "ox" -- [ox | jg | qb | lab | custom ] BridgeClientConfig.InputSystem = "auto" -- [ auto | ox | qb ] BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox | qb ]