From f7070ac334405e2ab4a1db4aa20e8e78515e9f68 Mon Sep 17 00:00:00 2001 From: Musiker15 Date: Sun, 1 Sep 2024 19:27:46 +0200 Subject: [PATCH] Update v2.4.3 * Fixed MSK.HasItem --- client/functions/main.lua | 5 ++--- fxmanifest.lua | 2 +- server/functions/callbacks.lua | 11 +---------- server/functions/main.lua | 17 ++++++----------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/client/functions/main.lua b/client/functions/main.lua index 5624d30..d3dcf5c 100644 --- a/client/functions/main.lua +++ b/client/functions/main.lua @@ -158,13 +158,12 @@ exports('DrawGenericText', MSK.DrawGenericText) RegisterNetEvent("msk_core:drawGenericText", MSK.DrawGenericText) MSK.HasItem = function(item) - if Config.Framework == 'Standalone' then + if MSK.Bridge.Framework.Type ~= 'ESX' and MSK.Bridge.Framework.Type ~= 'QBCore' then logging('error', ('Function %s can not used without Framework!'):format('MSK.HasItem')) return end - local hasItem = MSK.Trigger('msk_core:hasItem', item) - return hasItem + return MSK.Trigger('msk_core:hasItem', item) end exports('HasItem', MSK.HasItem) diff --git a/fxmanifest.lua b/fxmanifest.lua index 11728f3..dbd24a2 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.4.2' +version '2.4.3' lua54 'yes' diff --git a/server/functions/callbacks.lua b/server/functions/callbacks.lua index 3194d56..9d028d3 100644 --- a/server/functions/callbacks.lua +++ b/server/functions/callbacks.lua @@ -86,14 +86,5 @@ end) -- Server Callbacks with Method [return] ---------------------------------------------------------------- MSK.Register('msk_core:hasItem', function(source, item) - local src = source - local xPlayer - - if Config.Framework == 'ESX' then - xPlayer = ESX.GetPlayerFromId(src) - elseif Config.Framework == 'QBCore' then - xPlayer = QBCore.Functions.GetPlayer(src) - end - - return MSK.HasItem(xPlayer, item) + return MSK.HasItem(source, item) end) \ No newline at end of file diff --git a/server/functions/main.lua b/server/functions/main.lua index 6d45339..f2f2388 100644 --- a/server/functions/main.lua +++ b/server/functions/main.lua @@ -160,25 +160,20 @@ MSK.AddWebhook = function(webhook, botColor, botName, botAvatar, title, descript end exports('AddWebhook', MSK.AddWebhook) -MSK.HasItem = function(Player, item) - if not Player then +MSK.HasItem = function(playerId, item) + if not playerId then logging('error', 'Player on Function MSK.HasItem does not exist!') return end - if Config.Framework == 'Standalone' then + if MSK.Bridge.Framework.Type ~= 'ESX' and MSK.Bridge.Framework.Type ~= 'QBCore' then logging('error', ('Function %s can not used without Framework!'):format('^3MSK.HasItem^0')) return end - local hasItem - if Config.Framework == 'ESX' then - hasItem = Player.hasItem(item) - elseif Config.Framework == 'QBCore' then - hasItem = Player.Functions.GetItemByName(item) - end - - return hasItem + local Player = MSK.GetPlayerFromId(playerId) + + return Player.HasItem(item) end exports('HasItem', MSK.HasItem)