diff --git a/client/client.lua b/client/client.lua index 3fb781e..93dac62 100644 --- a/client/client.lua +++ b/client/client.lua @@ -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 @@ -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 diff --git a/client/functions.lua b/client/functions.lua index 6af8f7b..e3196fe 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -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 @@ -1979,9 +1979,8 @@ 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 @@ -1989,20 +1988,17 @@ RenderRoute = function(coords) 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 diff --git a/fxmanifest.lua b/fxmanifest.lua index 2924c00..d9e0096 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -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', diff --git a/shared/functions.lua b/shared/functions.lua deleted file mode 100644 index a448eae..0000000 --- a/shared/functions.lua +++ /dev/null @@ -1,18 +0,0 @@ -StringSplit = function(str, sep) - if not sep then - sep = '%s' - end - - local t, i = {}, 1 - - for str in string.gmatch(str, '([^'..sep..']+)') do - t[i] = str - i += 1 - end - - return t -end - -StartsWith = function(str, find) - return str:sub(1, #find) == find -end \ No newline at end of file