Skip to content

Commit

Permalink
Update v2.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Musiker15 committed Oct 28, 2024
1 parent 7f0f7e2 commit 8abc8ff
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 11 deletions.
40 changes: 32 additions & 8 deletions client/functions/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion client/functions/vehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
22 changes: 21 additions & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
34 changes: 34 additions & 0 deletions server/functions/registeritems.lua
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 8abc8ff

Please sign in to comment.