Skip to content

Commit

Permalink
Merge pull request #55 from CaptainStabs/patch-1
Browse files Browse the repository at this point in the history
Prevent selling more than player has
  • Loading branch information
GhzGarage committed Dec 23, 2023
2 parents d2efe9d + cd6f19b commit 7513365
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,18 @@ RegisterNetEvent('qb-pawnshop:client:pawnitems', function(item)
end

if tonumber(sellingItem.amount) > 0 then
TriggerServerEvent('qb-pawnshop:server:sellPawnItems', item.name, sellingItem.amount, item.price)
if tonumber(sellingItem.amount) <= item.amount then
TriggerServerEvent('qb-pawnshop:server:sellPawnItems', item.name, sellingItem.amount, item.price)
else
QBCore.Functions.Notify(Lang:t('error.no_items'), 'error')
end
else
QBCore.Functions.Notify(Lang:t('error.negative'), 'error')
end
end
end)


RegisterNetEvent('qb-pawnshop:client:meltItems', function(item)
local meltingItem = exports['qb-input']:ShowInput({
header = Lang:t('info.melt'),
Expand Down Expand Up @@ -331,4 +336,4 @@ end)

RegisterNetEvent('qb-pawnshop:client:resetPickup', function()
canTake = false
end)
end)

0 comments on commit 7513365

Please sign in to comment.