From ca1efdb4483fd097f56f280bdb6d984860f9e38c Mon Sep 17 00:00:00 2001 From: 0Programmer <60280452+0Programmer@users.noreply.github.com> Date: Mon, 15 Sep 2025 01:10:29 +0200 Subject: [PATCH 1/2] fix(client): run TaskTurnPedToFaceCoord once to preserve ongoing or new animations Signed-off-by: 0Programmer <60280452+0Programmer@users.noreply.github.com> --- client.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client.lua b/client.lua index 413f4a9ea..e62fe7fcd 100644 --- a/client.lua +++ b/client.lua @@ -1277,6 +1277,7 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven local hasTextUi local uiOptions = { icon = 'fa-id-card' } + local hasTurnPedToFace = false ---@param point CPoint local function nearbyLicense(point) @@ -1382,7 +1383,10 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven client.closeInventory() lib.notify({ id = 'inventory_lost_access', type = 'error', description = locale('inventory_lost_access') }) else - TaskTurnPedToFaceCoord(playerPed, pedCoords.x, pedCoords.y, pedCoords.z, 50) + if not hasTurnPedToFace then + hasTurnPedToFace = true + TaskTurnPedToFaceCoord(playerPed, pedCoords.x, pedCoords.y, pedCoords.z, 50) + end end elseif currentInventory.coords and (#(playerCoords - currentInventory.coords) > maxDistance or canSteal) then From 6e0b6ec128718440340cd5f83330954f1556f550 Mon Sep 17 00:00:00 2001 From: 0Programmer <60280452+0Programmer@users.noreply.github.com> Date: Mon, 15 Sep 2025 20:28:10 +0200 Subject: [PATCH 2/2] fix(client): replace TaskTurnPedToFaceCoord with SetEntityHeading to prevent canceled animations Replaced TaskTurnPedToFaceCoord with a manual heading calculation using GetHeadingFromVector_2d and SetEntityHeading. - Prevents ongoing or new animations from being canceled when searching/robbing a player. - Still ensures the ped faces the target at the start. This avoids the side effect of TaskTurnPedToFaceCoord canceling animations while keeping the aesthetic alignment. Signed-off-by: 0Programmer <60280452+0Programmer@users.noreply.github.com> --- client.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client.lua b/client.lua index e62fe7fcd..bdf5b71af 100644 --- a/client.lua +++ b/client.lua @@ -1277,7 +1277,6 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven local hasTextUi local uiOptions = { icon = 'fa-id-card' } - local hasTurnPedToFace = false ---@param point CPoint local function nearbyLicense(point) @@ -1383,10 +1382,8 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven client.closeInventory() lib.notify({ id = 'inventory_lost_access', type = 'error', description = locale('inventory_lost_access') }) else - if not hasTurnPedToFace then - hasTurnPedToFace = true - TaskTurnPedToFaceCoord(playerPed, pedCoords.x, pedCoords.y, pedCoords.z, 50) - end + local heading = GetHeadingFromVector_2d(pedCoords.x - playerCoords.x, pedCoords.y - playerCoords.y) + SetEntityHeading(playerPed, heading) end elseif currentInventory.coords and (#(playerCoords - currentInventory.coords) > maxDistance or canSteal) then