Skip to content

Commit

Permalink
fix(server): correct logic when clearing inventories with netid mismatch
Browse files Browse the repository at this point in the history
This should properly resolve #1870.
  • Loading branch information
thelindat committed Jan 30, 2025
1 parent a74e109 commit 399ec5f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,14 @@ local function openInventory(source, invType, data, ignoreSecurityChecks)
data.type = invType
right = Inventory(data)

if right and data.netid ~= right.netid then
local invEntity = NetworkGetEntityFromNetworkId(right.netid)
if right and data.netid ~= right.netid then
local invEntity = NetworkGetEntityFromNetworkId(right.netid)

if invEntity > 0 and DoesEntityExist(invEntity) or plate and not string.match(GetVehicleNumberPlateText(invEntity) or '', plate) then
return
end

Inventory.Remove(right)
right = Inventory(data)
end
if not (invEntity > 0 and DoesEntityExist(invEntity)) or (plate and not string.match(GetVehicleNumberPlateText(invEntity) or '', plate)) then
Inventory.Remove(right)
right = Inventory(data)
end
end
elseif invType == 'drop' then
right = Inventory(data.id)
else
Expand Down

0 comments on commit 399ec5f

Please sign in to comment.