diff --git a/client/functions/main.lua b/client/functions/main.lua index ff3f8fe..ae7db9b 100644 --- a/client/functions/main.lua +++ b/client/functions/main.lua @@ -7,6 +7,12 @@ MSK.Notification = function(title, message, typ, duration) exports.okokNotify:Alert(title, message, duration or 5000, typ or 'info') elseif Config.Notification == 'qb-core' then QBCore.Functions.Notify(message, typ, duration) + elseif Config.Notification == 'bulletin' then + exports.bulletin:Send({ + message = message, + timeout = duration or 5000, + theme = typ or 'info' + }) elseif Config.Notification == 'custom' then Config.customNotification(title, message, typ or 'info', duration or 5000) else @@ -23,10 +29,16 @@ MSK.Notify = MSK.Notification exports('Notification', MSK.Notification) RegisterNetEvent("msk_core:notification", MSK.Notification) -MSK.HelpNotification = function(text) - BeginTextCommandDisplayHelp('STRING') - AddTextComponentSubstringPlayerName(text) - EndTextCommandDisplayHelp(0, false, true, -1) +MSK.HelpNotification = function(text, key) + if Config.HelpNotification == 'native' then + BeginTextCommandDisplayHelp('STRING') + AddTextComponentSubstringPlayerName(text) + EndTextCommandDisplayHelp(0, false, true, -1) + elseif Config.HelpNotification == 'custom' then + Config.customHelpNotification(text) + else + MSK.TextUI.ShowThread(key, text) + end end MSK.HelpNotify = MSK.HelpNotification exports('HelpNotification', MSK.HelpNotification) @@ -37,10 +49,22 @@ MSK.AdvancedNotification = function(text, title, subtitle, icon, flash, icontype if not icontype then icontype = 1 end if not icon then icon = 'CHAR_HUMANDEFAULT' end - BeginTextCommandThefeedPost('STRING') - AddTextComponentSubstringPlayerName(text) - EndTextCommandThefeedPostMessagetext(icon, icon, flash, icontype, title, subtitle) - EndTextCommandThefeedPostTicker(false, true) + if Config.AdvancedNotification == 'bulletin' and GetResourceState('bulletin') == 'started' then + exports.bulletin:SendAdvanced({ + message = text, + title = title, + subject = subtitle, + icon = icon, + timeout = 5000 + }) + elseif Config.AdvancedNotification == 'custom' then + Config.customAdvancedNotification(text, title, subtitle, icon, flash, icontype) + else + BeginTextCommandThefeedPost('STRING') + AddTextComponentSubstringPlayerName(text) + EndTextCommandThefeedPostMessagetext(icon, icon, flash, icontype, title, subtitle) + EndTextCommandThefeedPostTicker(false, true) + end end MSK.AdvancedNotify = MSK.AdvancedNotification exports('AdvancedNotification', MSK.AdvancedNotification) diff --git a/client/functions/vehicle.lua b/client/functions/vehicle.lua index 736fa3d..82ba446 100644 --- a/client/functions/vehicle.lua +++ b/client/functions/vehicle.lua @@ -102,7 +102,7 @@ exports('GetVehicleLabel', MSK.GetVehicleLabel) MSK.GetVehicleLabelFromModel = function(model) assert(model, ('Parameter "model" is nil on function GetVehicleLabelFromModel (reveived %s)'):format(model)) - return GetVehicleLabel(nil, model) + return MSK.GetVehicleLabel(nil, model) end exports('GetVehicleLabelFromModel', MSK.GetVehicleLabelFromModel) diff --git a/config.lua b/config.lua index 01ed3ae..7ed7e9d 100644 --- a/config.lua +++ b/config.lua @@ -26,10 +26,11 @@ Config.copyCoords = { } ---------------------------------------------------------------- -- Set to 'msk' for MSK UI Notification +-- Set to 'native' for FiveM Native Notification -- Set to 'custom' for Config.customNotification() -- Set to 'okok' for OKOK Notification -- Set to 'qb-core' for QBCore Notification --- Set to 'native' for FiveM Native Notification +-- Set to 'bulletin' for bulletin notification (https://github.com/Mobius1/bulletin) Config.Notification = 'msk' -- Only for MSK Notification @@ -47,6 +48,25 @@ Config.customNotification = function(title, message, typ, duration) -- Add your own clientside Notification here end ---------------------------------------------------------------- +-- Set to 'native' for FiveM Native AdvancedNotification +-- Set to 'custom' for Config.customAdvancedNotification() +-- Set to 'bulletin' for bulletin AdvancedNotification (https://github.com/Mobius1/bulletin) +Config.AdvancedNotification = 'native' + +Config.customAdvancedNotification = function(text, title, subtitle, icon, flash, icontype) + -- Set Config.AdvancedNotification = 'custom' + -- Add your own clientside AdvancedNotification here +end +---------------------------------------------------------------- +-- Set to 'msk' for MSK TextUI Notification +-- Set to 'native' for FiveM Native HelpNotification +-- Set to 'custom' for Config.customHelpNotification() +Config.HelpNotification = 'msk' + +-- This will be called every frame -> Wait(0) +Config.customHelpNotification = function(text) +end +---------------------------------------------------------------- Config.ProgressColor = "#5eb131" -- Default Color for ProgressBar Config.TextUIColor = "#5eb131" -- Default Color for TextUI ---------------------------------------------------------------- diff --git a/fxmanifest.lua b/fxmanifest.lua index 98777af..ed6c755 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ games { 'gta5' } author 'Musiker15 - MSK Scripts' name 'msk_core' description 'Functions for MSK Scripts' -version '2.7.0' +version '2.7.1' lua54 'yes' diff --git a/server/functions/registeritems.lua b/server/functions/registeritems.lua new file mode 100644 index 0000000..32dffce --- /dev/null +++ b/server/functions/registeritems.lua @@ -0,0 +1,34 @@ +local RegisteredItems = {} + +MSK.GetRegisteredItems = function() + return RegisteredItems +end +exports('GetRegisteredItems', MSK.GetRegisteredItems) + +MSK.GetRegisteredItem = function(itemName) + return RegisteredItems[itemName] or false +end +exports('GetRegisteredItem', MSK.GetRegisteredItem) + +MSK.RegisterItem = function(itemName, cb) + RegisteredItems[itemName] = cb + + if RegisteredItems[itemName] then + MSK.Logging('info', ('Item ^3%s^0 is already registerd. Overriding Item...'):format(itemName)) + end + + if MSK.Bridge.Inventory == 'qs-inventory' then + exports['qs-inventory']:CreateUsableItem(itemName, cb) + elseif MSK.Bridge.Inventory ~= 'ox_inventory' then + if MSK.Bridge.Framework.Type == 'ESX' then + ESX.RegisterUsableItem(itemName, cb) + elseif MSK.Bridge.Framework.Type == 'QBCore' then + QBCore.Functions.CreateUseableItem(itemName, cb) + end + end + + if MSK.Bridge.Framework.Type == 'STANDALONE' then + -- Register the item here + end +end +exports('RegisterItem', MSK.RegisterItem) \ No newline at end of file