Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
[/] Fixed a issue with the route calculating
  • Loading branch information
zRxnx committed Oct 17, 2023
1 parent 2b19223 commit 7adeb65
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 31 deletions.
9 changes: 6 additions & 3 deletions client/client.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CORE = exports.zrx_utility:GetUtility()
COOLDOWN, DATA_BLIP, DATA_ROUTE, DATA_CLOTHING = false, {}, {}, {}
COOLDOWN, DATA_BLIP,DATA_ROUTE, DATA_CLOTHING = false, {}, {}, {}
DATA_ROUTE.coords = {}
local GetEntityCoords = GetEntityCoords
local SetBlipRoute = SetBlipRoute
local RemoveBlip = RemoveBlip
local ClearGpsMultiRoute = ClearGpsMultiRoute
local SetGpsMultiRouteRender = SetGpsMultiRouteRender
local vector3 = vector3
local Wait = Wait

Expand All @@ -15,6 +15,9 @@ AddEventHandler('onResourceStop', function(res)
if res ~= GetCurrentResourceName() then return end
if not Config.Menu.clothe then return end

ClearGpsMultiRoute()
SetGpsMultiRouteRender(false)

if DATA_CLOTHING?.arms?.state then
SetPedComponentVariation(cache.ped, 3, DATA_CLOTHING.arms.drawable, DATA_CLOTHING.arms.texture, 2)
end
Expand Down
14 changes: 5 additions & 9 deletions client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1964,10 +1964,10 @@ OpenNavigationPresetMenu = function()
end

RenderRoute = function(coords)
if #DATA_ROUTE.coords < 1 then
if not DATA_ROUTE.start then
local pedCoords = GetEntityCoords(cache.ped)

DATA_ROUTE.coords[#DATA_ROUTE.coords + 1] = vector3(pedCoords.x, pedCoords.y, pedCoords.z)
DATA_ROUTE.start = vector3(pedCoords.x, pedCoords.y, pedCoords.z)
end

if coords then
Expand All @@ -1979,30 +1979,26 @@ RenderRoute = function(coords)
SetGpsMultiRouteRender(false)
StartGpsMultiRoute(26, false, true)

print(CORE.Shared.DumpTable(DATA_ROUTE.coords))
AddPointToGpsMultiRoute(DATA_ROUTE.start.x, DATA_ROUTE.start.y, DATA_ROUTE.start.z)
for i, data in ipairs(DATA_ROUTE.coords) do
print(i, data)
AddPointToGpsMultiRoute(data.x, data.y, data.z)
end

SetGpsMultiRouteRender(true)
end

RemoveDestionation = function(index)
print('rem', DATA_ROUTE.last, DATA_BLIP[index].coords)
if DATA_ROUTE.last == DATA_BLIP[index].coords then
print('rem1', #DATA_ROUTE.coords)
if #DATA_ROUTE.coords - 1 > 1 then
print('rem2', DATA_ROUTE.coords[2])
if #DATA_ROUTE.coords > 1 then
DATA_ROUTE.last = DATA_ROUTE.coords[2]
else
print('rem3')
DATA_ROUTE.coords = {}
DATA_ROUTE.last = nil
ClearGpsMultiRoute()
end
end

DATA_ROUTE.start = nil
for i, data in pairs(DATA_ROUTE.coords) do
if DATA_BLIP[index].coords == data then
DATA_ROUTE.coords[i] = nil
Expand Down
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'

author 'zRxnx'
description 'Advanced personal menu system'
version '2.3.0'
version '2.3.1'

dependencies {
'zrx_utility',
Expand Down
18 changes: 0 additions & 18 deletions shared/functions.lua

This file was deleted.

0 comments on commit 7adeb65

Please sign in to comment.