From f8f71cce78d9cd49b906d885fb14910a71f0ae9f Mon Sep 17 00:00:00 2001 From: Zerio Date: Sat, 25 May 2024 17:21:42 +0200 Subject: [PATCH 1/3] feat: include coords in entity data --- client.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.lua b/client.lua index 2a51960..0167b82 100644 --- a/client.lua +++ b/client.lua @@ -191,6 +191,9 @@ local function SetupOptions(datatable, entity, distance, isZone) slot = data.num or slot + 1 sendData[slot] = data sendData[slot].entity = entity + if entity then + sendData[slot].coords = GetEntityCoords(entity) + end nuiData[slot] = { icon = data.icon, targeticon = data.targeticon, From 5d4c5dbde492bcbc363670940042e547505ed0e1 Mon Sep 17 00:00:00 2001 From: Zerio Date: Sat, 25 May 2024 17:25:45 +0200 Subject: [PATCH 2/3] chore: move logic --- client.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client.lua b/client.lua index 0167b82..bcd98d6 100644 --- a/client.lua +++ b/client.lua @@ -191,9 +191,6 @@ local function SetupOptions(datatable, entity, distance, isZone) slot = data.num or slot + 1 sendData[slot] = data sendData[slot].entity = entity - if entity then - sendData[slot].coords = GetEntityCoords(entity) - end nuiData[slot] = { icon = data.icon, targeticon = data.targeticon, @@ -1195,6 +1192,9 @@ RegisterNUICallback('selectTarget', function(option, cb) table_wipe(sendData) CreateThread(function() Wait(0) + if data.entity ~= nil then + data.coords = GetEntityCoords(data.entity) + end if data.action then data.action(data.entity) elseif data.event then From 1f64dcdf7971d660f1889577f976511b36538ca5 Mon Sep 17 00:00:00 2001 From: Zerio Date: Sat, 25 May 2024 15:29:29 +0000 Subject: [PATCH 3/3] fix: lint issues --- client.lua | 6 +++--- init.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client.lua b/client.lua index bcd98d6..e92f36f 100644 --- a/client.lua +++ b/client.lua @@ -390,7 +390,7 @@ local function EnableTarget() if data and next(data) then CheckEntity(flag, data, entity, distance) end end else - sleep += 20 + sleep = sleep + 20 end if not success then -- Zone targets @@ -436,14 +436,14 @@ local function EnableTarget() DrawOutlineEntity(entity, false) end else - sleep += 20 + sleep = sleep + 20 end else LeftTarget() DrawOutlineEntity(entity, false) end else - sleep += 20 + sleep = sleep + 20 end Wait(sleep) end diff --git a/init.lua b/init.lua index 3bfd2d0..4c82a93 100644 --- a/init.lua +++ b/init.lua @@ -122,7 +122,7 @@ CreateThread(function() if state ~= 'missing' then local timeout = 0 while state ~= 'started' and timeout <= 100 do - timeout += 1 + timeout = timeout + 1 state = GetResourceState('qb-core') Wait(0) end