@@ -22,10 +22,10 @@ MSK.GetRandomLetter = function(length)
2222 end
2323end
2424
25- MSK .RegisterCommand = function (name , group , cb , console , suggestion )
25+ MSK .RegisterCommand = function (name , group , cb , console , framework , suggestion )
2626 if type (name ) == ' table' then
2727 for k , v in ipairs (name ) do
28- MSK .RegisterCommand (v , group , cb , console , suggestion )
28+ MSK .RegisterCommand (v , group , cb , console , framework , suggestion )
2929 end
3030 return
3131 end
@@ -86,14 +86,14 @@ MSK.RegisterCommand = function(name, group, cb, console, suggestion)
8686 MSK .Notification (source , error )
8787 end
8888 else
89- if Config .Framework :match (' standalone' ) then
90- cb (source , args , rawCommand )
91- elseif Config .Framework :match (' esx' ) then
89+ if Config .Framework :match (' esx' ) and framework then
9290 local xPlayer = ESX .GetPlayerFromId (source )
9391 cb (xPlayer , args , rawCommand )
94- elseif Config .Framework :match (' qbcore' ) then
92+ elseif Config .Framework :match (' qbcore' ) and framework then
9593 local Player = QBCore .Functions .GetPlayer (source )
9694 cb (Player , args , rawCommand )
95+ elseif Config .Framework :match (' standalone' ) or not framework then
96+ cb (source , args , rawCommand )
9797 end
9898 end
9999 end
@@ -128,6 +128,7 @@ MSK.Table_Contains = function(table, value)
128128 end
129129 end
130130 end
131+ return false
131132end
132133
133134MSK .AddWebhook = function (webhook , botColor , botName , botAvatar , title , description , fields , footer , time )
@@ -174,6 +175,38 @@ MSK.logging = function(script, code, ...)
174175 end
175176end
176177
178+ MSK .HasItem = function (xPlayer , item )
179+ if not xPlayer then logging (' error' , ' Player on Function MSK.HasItem does not exist!' ) return end
180+ if not Config .Framework :match (' esx' ) or Config .Framework :match (' qbcore' ) then
181+ logging (' error' , (' Function %s can not used without Framework!' ):format (' ^3MSK.HasItem^0' ))
182+ return
183+ end
184+ local hasItem
185+
186+ if Config .Framework :match (' esx' ) then
187+ hasItem = xPlayer .getInventoryItem (item )
188+ elseif Config .Framework :match (' qbcore' ) then
189+ hasItem = xPlayer .Functions .GetItemByName (item )
190+ else
191+ logging (' error' , ' Framework on Function MSK.HasItem is not configured!' )
192+ end
193+
194+ return hasItem
195+ end
196+
197+ MSK .RegisterCallback (' msk_core:hasItem' , function (source , cb , item )
198+ local src = source
199+ local xPlayer
200+
201+ if Config .Framework :match (' esx' ) then
202+ xPlayer = ESX .GetPlayerFromId (src )
203+ elseif Config .Framework :match (' qbcore' ) then
204+ xPlayer = QBCore .Functions .GetPlayer (src )
205+ end
206+
207+ cb (MSK .HasItem (xPlayer , item ))
208+ end )
209+
177210RegisterNetEvent (' msk_core:triggerCallback' )
178211AddEventHandler (' msk_core:triggerCallback' , function (name , requestId , ...)
179212 local src = source
0 commit comments