Skip to content

Commit

Permalink
Inventory Update
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed May 20, 2024
1 parent a2f5045 commit fe55cfa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ RegisterNetEvent('qb-diving:server:SellCoral', function()
local item = Player.Functions.GetItemByName(v.item)
local price = item.amount * v.price
local reward = getItemPrice(item.amount, price)
Player.Functions.RemoveItem(item.name, item.amount)
Player.Functions.AddMoney('cash', reward, 'sold-coral')
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item.name], 'remove')
exports['qb-inventory']:RemoveItem(src, item.name, item.amount, false, 'qb-diving:server:SellCoral')
Player.Functions.AddMoney('cash', reward, 'qb-diving:server:SellCoral')
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item.name], 'remove')
end
else
TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_coral'), 'error')
Expand All @@ -73,13 +73,13 @@ RegisterNetEvent('qb-diving:server:TakeCoral', function(area, coral, bool)
local ItemData = QBCore.Shared.Items[Config.CoralTypes[coralType].item]
if amount > 1 then
for _ = 1, amount, 1 do
Player.Functions.AddItem(ItemData['name'], 1)
TriggerClientEvent('inventory:client:ItemBox', src, ItemData, 'add')
exports['qb-inventory']:AddItem(src, ItemData['name'], 1, false, false, 'qb-diving:server:TakeCoral')
TriggerClientEvent('qb-inventory:client:ItemBox', src, ItemData, 'add')
Wait(250)
end
else
Player.Functions.AddItem(ItemData['name'], amount)
TriggerClientEvent('inventory:client:ItemBox', src, ItemData, 'add')
exports['qb-inventory']:AddItem(src, ItemData['name'], amount, false, false, 'qb-diving:server:TakeCoral')
TriggerClientEvent('qb-inventory:client:ItemBox', src, ItemData, 'add')
end
if (Config.CoralLocations[area].TotalCoral - 1) == 0 then
for _, v in pairs(Config.CoralLocations[currentDivingArea].coords.Coral) do
Expand All @@ -103,8 +103,8 @@ end)
RegisterNetEvent('qb-diving:server:removeItemAfterFill', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
Player.Functions.RemoveItem('diving_fill', 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['diving_fill'], 'remove')
exports['qb-inventory']:RemoveItem(src, 'diving_fill', 1, false, 'qb-diving:server:removeItemAfterFill')
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items['diving_fill'], 'remove')
end)

-- Callbacks
Expand Down

0 comments on commit fe55cfa

Please sign in to comment.