From 8f35de998b71f670a51a15e148bdbe78e0564bb6 Mon Sep 17 00:00:00 2001 From: Marcelo Silva <25794492+tugamars@users.noreply.github.com> Date: Sat, 21 Feb 2026 22:42:39 +0000 Subject: [PATCH 1/7] Added possibility to give items through windows Signed-off-by: Marcelo Silva <25794492+tugamars@users.noreply.github.com> --- client.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client.lua b/client.lua index 413f4a9ea7..400bda1bc2 100644 --- a/client.lua +++ b/client.lua @@ -1689,6 +1689,13 @@ local function isGiveTargetValid(ped, coords) local entity = Utils.Raycast(1|2|4|8|16, coords + vec3(0, 0, 0.5), 0.2) + if(GetVehiclePedIsIn(ped, false) and not cache.vehicle) then + local currCoords=GetWorldPositionOfEntityBone(ped,0); + if( #( pedCoords.xy - currCoords.xy ) <= 2.0) then + return true; + end + end + return entity == ped and IsEntityVisible(ped) end @@ -1698,7 +1705,13 @@ RegisterNUICallback('giveItem', function(data, cb) if usingItem then return end if client.giveplayerlist then - local nearbyPlayers = lib.getNearbyPlayers(GetEntityCoords(playerPed), 3.0) + local coords=GetEntityCoords(playerPed); + + if(cache.vehicle) then + coords=GetWorldPositionOfEntityBone(playerPed,0); + end + + local nearbyPlayers = lib.getNearbyPlayers(coords, 3.0) local nearbyCount = #nearbyPlayers if nearbyCount == 0 then return end From b3e7b948224a3c2c581eb99417ef10d5c22ed864 Mon Sep 17 00:00:00 2001 From: Marcelo Silva <25794492+tugamars@users.noreply.github.com> Date: Mon, 23 Feb 2026 17:08:11 +0000 Subject: [PATCH 2/7] Refactor vehicle check and coordinate retrieval Signed-off-by: Marcelo Silva <25794492+tugamars@users.noreply.github.com> --- client.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client.lua b/client.lua index 400bda1bc2..3e89cfa12c 100644 --- a/client.lua +++ b/client.lua @@ -1689,10 +1689,10 @@ local function isGiveTargetValid(ped, coords) local entity = Utils.Raycast(1|2|4|8|16, coords + vec3(0, 0, 0.5), 0.2) - if(GetVehiclePedIsIn(ped, false) and not cache.vehicle) then - local currCoords=GetWorldPositionOfEntityBone(ped,0); - if( #( pedCoords.xy - currCoords.xy ) <= 2.0) then - return true; + if GetVehiclePedIsIn(ped, false) and not cache.vehicle then + local currCoords=GetWorldPositionOfEntityBone(ped,0) + if #(pedCoords.xy - currCoords.xy) <= 2.0 then + return true end end @@ -1705,10 +1705,10 @@ RegisterNUICallback('giveItem', function(data, cb) if usingItem then return end if client.giveplayerlist then - local coords=GetEntityCoords(playerPed); + local coords=GetEntityCoords(playerPed) - if(cache.vehicle) then - coords=GetWorldPositionOfEntityBone(playerPed,0); + if cache.vehicle then + coords=GetWorldPositionOfEntityBone(playerPed,0) end local nearbyPlayers = lib.getNearbyPlayers(coords, 3.0) From 7939923ad08fa1951a9fc3aa4946bc274a004c58 Mon Sep 17 00:00:00 2001 From: Marcelo Silva <25794492+tugamars@users.noreply.github.com> Date: Thu, 9 Apr 2026 21:56:49 +0100 Subject: [PATCH 3/7] Format code for consistency in client.lua Signed-off-by: Marcelo Silva <25794492+tugamars@users.noreply.github.com> --- client.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.lua b/client.lua index 3e89cfa12c..3b3f7a3d4e 100644 --- a/client.lua +++ b/client.lua @@ -1690,7 +1690,7 @@ local function isGiveTargetValid(ped, coords) local entity = Utils.Raycast(1|2|4|8|16, coords + vec3(0, 0, 0.5), 0.2) if GetVehiclePedIsIn(ped, false) and not cache.vehicle then - local currCoords=GetWorldPositionOfEntityBone(ped,0) + local currCoords=GetWorldPositionOfEntityBone(ped, 0) if #(pedCoords.xy - currCoords.xy) <= 2.0 then return true end @@ -1708,7 +1708,7 @@ RegisterNUICallback('giveItem', function(data, cb) local coords=GetEntityCoords(playerPed) if cache.vehicle then - coords=GetWorldPositionOfEntityBone(playerPed,0) + coords=GetWorldPositionOfEntityBone(playerPed, 0) end local nearbyPlayers = lib.getNearbyPlayers(coords, 3.0) From ed471c265b690182c6b66c304916655d434d0a47 Mon Sep 17 00:00:00 2001 From: Marcelo Silva <25794492+tugamars@users.noreply.github.com> Date: Thu, 30 Apr 2026 08:07:36 +0100 Subject: [PATCH 4/7] Refactor vehicle checks and coordinate retrieval Signed-off-by: Marcelo Silva <25794492+tugamars@users.noreply.github.com> --- client.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client.lua b/client.lua index 3b3f7a3d4e..ec605c9693 100644 --- a/client.lua +++ b/client.lua @@ -184,13 +184,13 @@ function client.openInventory(inv, data) end if inv == 'shop' and invOpen == false then - if cache.vehicle then + if then return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') }) end left, right, accessError = lib.callback.await('ox_inventory:openShop', 200, data) elseif inv == 'crafting' then - if cache.vehicle then + if then return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') }) end @@ -254,7 +254,7 @@ function client.openInventory(inv, data) end - if not cache.vehicle then + if not then if inv == 'player' then Utils.PlayAnim(0, 'mp_common', 'givetake1_a', 8.0, 1.0, 2000, 50, 0.0, 0, 0, 0) elseif inv ~= 'trunk' then @@ -1705,11 +1705,7 @@ RegisterNUICallback('giveItem', function(data, cb) if usingItem then return end if client.giveplayerlist then - local coords=GetEntityCoords(playerPed) - - if cache.vehicle then - coords=GetWorldPositionOfEntityBone(playerPed, 0) - end + local coords = cache.vehicle and GetWorldPositionOfEntityBone(playerPed, 0) or GetEntityCoords(playerPed) local nearbyPlayers = lib.getNearbyPlayers(coords, 3.0) local nearbyCount = #nearbyPlayers From a5f6b70c6efa9e430f41009f79bb9949927a2581 Mon Sep 17 00:00:00 2001 From: tugamars <25794492+tugamars@users.noreply.github.com> Date: Thu, 30 Apr 2026 08:10:16 +0100 Subject: [PATCH 5/7] Revert "Refactor vehicle checks and coordinate retrieval" This reverts commit ed471c265b690182c6b66c304916655d434d0a47. --- client.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/client.lua b/client.lua index ec605c9693..3b3f7a3d4e 100644 --- a/client.lua +++ b/client.lua @@ -184,13 +184,13 @@ function client.openInventory(inv, data) end if inv == 'shop' and invOpen == false then - if then + if cache.vehicle then return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') }) end left, right, accessError = lib.callback.await('ox_inventory:openShop', 200, data) elseif inv == 'crafting' then - if then + if cache.vehicle then return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') }) end @@ -254,7 +254,7 @@ function client.openInventory(inv, data) end - if not then + if not cache.vehicle then if inv == 'player' then Utils.PlayAnim(0, 'mp_common', 'givetake1_a', 8.0, 1.0, 2000, 50, 0.0, 0, 0, 0) elseif inv ~= 'trunk' then @@ -1705,7 +1705,11 @@ RegisterNUICallback('giveItem', function(data, cb) if usingItem then return end if client.giveplayerlist then - local coords = cache.vehicle and GetWorldPositionOfEntityBone(playerPed, 0) or GetEntityCoords(playerPed) + local coords=GetEntityCoords(playerPed) + + if cache.vehicle then + coords=GetWorldPositionOfEntityBone(playerPed, 0) + end local nearbyPlayers = lib.getNearbyPlayers(coords, 3.0) local nearbyCount = #nearbyPlayers From 42fccde7ecc2272e279c9de14485d44f4cad6739 Mon Sep 17 00:00:00 2001 From: Marcelo Silva <25794492+tugamars@users.noreply.github.com> Date: Thu, 30 Apr 2026 08:11:36 +0100 Subject: [PATCH 6/7] Simplify coordinate retrieval for nearby players Signed-off-by: Marcelo Silva <25794492+tugamars@users.noreply.github.com> --- client.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client.lua b/client.lua index 3b3f7a3d4e..396045a270 100644 --- a/client.lua +++ b/client.lua @@ -1705,11 +1705,7 @@ RegisterNUICallback('giveItem', function(data, cb) if usingItem then return end if client.giveplayerlist then - local coords=GetEntityCoords(playerPed) - - if cache.vehicle then - coords=GetWorldPositionOfEntityBone(playerPed, 0) - end + local coords = cache.vehicle and GetWorldPositionOfEntityBone(playerPed, 0) or GetEntityCoords(playerPed) local nearbyPlayers = lib.getNearbyPlayers(coords, 3.0) local nearbyCount = #nearbyPlayers From 6cf4340aaf9621ffcb288d54c32d69fb92c748f9 Mon Sep 17 00:00:00 2001 From: Marcelo Silva <25794492+tugamars@users.noreply.github.com> Date: Sat, 2 May 2026 23:30:56 +0100 Subject: [PATCH 7/7] Update raycasting parameters and clean up code Refactor raycasting logic and remove unused vehicle check. Signed-off-by: Marcelo Silva <25794492+tugamars@users.noreply.github.com> --- client.lua | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/client.lua b/client.lua index 396045a270..c88a9a1ccf 100644 --- a/client.lua +++ b/client.lua @@ -1687,14 +1687,7 @@ local function isGiveTargetValid(ped, coords) return true end - local entity = Utils.Raycast(1|2|4|8|16, coords + vec3(0, 0, 0.5), 0.2) - - if GetVehiclePedIsIn(ped, false) and not cache.vehicle then - local currCoords=GetWorldPositionOfEntityBone(ped, 0) - if #(pedCoords.xy - currCoords.xy) <= 2.0 then - return true - end - end + local entity = Utils.Raycast(1|4|8|16, coords + vec3(0, 0, 0.5), 0.2) return entity == ped and IsEntityVisible(ped) end