Skip to content

Commit

Permalink
Update v2.4.3
Browse files Browse the repository at this point in the history
* Fixed MSK.HasItem
  • Loading branch information
Musiker15 committed Sep 1, 2024
1 parent 02e0dd4 commit f7070ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
5 changes: 2 additions & 3 deletions client/functions/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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.4.2'
version '2.4.3'

lua54 'yes'

Expand Down
11 changes: 1 addition & 10 deletions server/functions/callbacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 6 additions & 11 deletions server/functions/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f7070ac

Please sign in to comment.