-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
21 lines (13 loc) · 727 Bytes
/
server.lua
File metadata and controls
21 lines (13 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local QBCore = exports[Config.Core]:GetCoreObject()
for _, conversion in pairs(Config.ItemsToConvert) do
QBCore.Functions.CreateUseableItem(conversion.usedItem, function(source, item)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if Player.Functions.GetItemByName(item.name) then
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item.name], 'remove')
Player.Functions.RemoveItem(item.name, 1)
Player.Functions.AddItem(conversion.givenItem, conversion.amount)
TriggerClientEvent('openpacks:client:ShowItemUsedMessage', src, item.name, conversion.givenItem, conversion.amount)
end
end)
end