From 399ec5f93d78a52aee35357da9caf13a7f08b01c Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Thu, 30 Jan 2025 14:50:45 +1100 Subject: [PATCH] fix(server): correct logic when clearing inventories with netid mismatch This should properly resolve #1870. --- server.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/server.lua b/server.lua index a545040e0..f229f6aa7 100644 --- a/server.lua +++ b/server.lua @@ -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