diff --git a/[esx_addons]/esx_atm/client/main.lua b/[esx_addons]/esx_atm/client/main.lua index 7db84456..28aa00a6 100644 --- a/[esx_addons]/esx_atm/client/main.lua +++ b/[esx_addons]/esx_atm/client/main.lua @@ -51,7 +51,7 @@ Citizen.CreateThread(function() isInATMMarker = false for k,v in pairs(Config.ATMLocations) do - if GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < 1.0 then + if #(coords - v) < 1.0 then isInATMMarker, canSleep = true, false break end diff --git a/[esx_addons]/esx_boat/client/marker.lua b/[esx_addons]/esx_boat/client/marker.lua index 46e18481..1136c324 100644 --- a/[esx_addons]/esx_boat/client/marker.lua +++ b/[esx_addons]/esx_boat/client/marker.lua @@ -85,7 +85,7 @@ Citizen.CreateThread(function() local currentZone, currentZoneNum for i=1, #Config.Zones.BoatShops, 1 do - local distance = GetDistanceBetweenCoords(coords, Config.Zones.BoatShops[i].Outside, true) + local distance = #(coords - Config.Zones.BoatShops[i].Outside) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, Config.Zones.BoatShops[i].Outside, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, 100, false, true, 2, false, nil, nil, false) @@ -100,7 +100,7 @@ Citizen.CreateThread(function() end for i=1, #Config.Zones.Garages, 1 do - local distance = GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].GaragePos, true) + local distance = #(coords - Config.Zones.Garages[i].GaragePos) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, Config.Zones.Garages[i].GaragePos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, 100, false, true, 2, false, nil, nil, false) @@ -113,7 +113,7 @@ Citizen.CreateThread(function() currentZoneNum = i end - distance = GetDistanceBetweenCoords(coords, Config.Zones.Garages[i].StorePos, true) + distance = #(coords - Config.Zones.Garages[i].StorePos) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, Config.Zones.Garages[i].StorePos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.StoreMarker.x, Config.StoreMarker.y, Config.StoreMarker.z, Config.StoreMarker.r, Config.StoreMarker.g, Config.StoreMarker.b, 100, false, true, 2, false, nil, nil, false) diff --git a/[esx_addons]/esx_dmvschool/client/main.lua b/[esx_addons]/esx_dmvschool/client/main.lua index be6e2db1..89761a6f 100644 --- a/[esx_addons]/esx_dmvschool/client/main.lua +++ b/[esx_addons]/esx_dmvschool/client/main.lua @@ -220,7 +220,7 @@ Citizen.CreateThread(function() local coords = GetEntityCoords(PlayerPedId()) for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + if(v.Type ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false) end end @@ -238,7 +238,7 @@ Citizen.CreateThread(function() local currentZone = nil for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + if(#(coords - v.Pos) < v.Size.x) then isInMarker = true currentZone = k end @@ -335,7 +335,7 @@ Citizen.CreateThread(function() LastCheckPoint = CurrentCheckPoint end - local distance = GetDistanceBetweenCoords(coords, Config.CheckPoints[nextCheckPoint].Pos.x, Config.CheckPoints[nextCheckPoint].Pos.y, Config.CheckPoints[nextCheckPoint].Pos.z, true) + local distance = #(coords - Config.CheckPoints[nextCheckPoint].Pos) if distance <= 100.0 then DrawMarker(1, Config.CheckPoints[nextCheckPoint].Pos.x, Config.CheckPoints[nextCheckPoint].Pos.y, Config.CheckPoints[nextCheckPoint].Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.5, 1.5, 1.5, 102, 204, 102, 100, false, true, 2, false, false, false, false) diff --git a/[esx_addons]/esx_drugs/client/main.lua b/[esx_addons]/esx_drugs/client/main.lua index 085291d9..66f3e9d0 100644 --- a/[esx_addons]/esx_drugs/client/main.lua +++ b/[esx_addons]/esx_drugs/client/main.lua @@ -7,7 +7,7 @@ Citizen.CreateThread(function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - if GetDistanceBetweenCoords(coords, Config.CircleZones.DrugDealer.coords, true) < 0.5 then + if #(coords - Config.CircleZones.DrugDealer.coords) < 0.5 then if not menuOpen then ESX.ShowHelpNotification(_U('dealer_prompt')) diff --git a/[esx_addons]/esx_drugs/client/weed.lua b/[esx_addons]/esx_drugs/client/weed.lua index 658817fc..4147d79a 100644 --- a/[esx_addons]/esx_drugs/client/weed.lua +++ b/[esx_addons]/esx_drugs/client/weed.lua @@ -7,7 +7,7 @@ Citizen.CreateThread(function() Citizen.Wait(500) local coords = GetEntityCoords(PlayerPedId()) - if GetDistanceBetweenCoords(coords, Config.CircleZones.WeedField.coords, true) < 50 then + if #(coords - Config.CircleZones.WeedField.coords) < 50 then SpawnWeedPlants() end end @@ -19,7 +19,7 @@ Citizen.CreateThread(function() local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) - if GetDistanceBetweenCoords(coords, Config.CircleZones.WeedProcessing.coords, true) < 1 then + if #(coords - Config.CircleZones.WeedProcessing.coords) < 1 then if not isProcessing then ESX.ShowHelpNotification(_U('weed_processprompt')) end @@ -60,7 +60,7 @@ function ProcessWeed(xCannabis) Citizen.Wait(1000) timeLeft = timeLeft - 1 - if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then + if #(GetEntityCoords(playerPed) - Config.CircleZones.WeedProcessing.coords) > 4 then ESX.ShowNotification(_U('weed_processingtoofar')) TriggerServerEvent('esx_drugs:cancelProcessing') TriggerServerEvent('esx_drugs:outofbound') @@ -80,7 +80,7 @@ Citizen.CreateThread(function() local nearbyObject, nearbyID for i=1, #weedPlants, 1 do - if GetDistanceBetweenCoords(coords, GetEntityCoords(weedPlants[i]), false) < 1 then + if #(coords - GetEntityCoords(weedPlants[i])) < 1 then nearbyObject, nearbyID = weedPlants[i], i end end @@ -148,12 +148,12 @@ function ValidateWeedCoord(plantCoord) local validate = true for k, v in pairs(weedPlants) do - if GetDistanceBetweenCoords(plantCoord, GetEntityCoords(v), true) < 5 then + if #(plantCoord - GetEntityCoords(v)) < 5 then validate = false end end - if GetDistanceBetweenCoords(plantCoord, Config.CircleZones.WeedField.coords, false) > 50 then + if #(plantCoord - Config.CircleZones.WeedField.coords) > 50 then validate = false end diff --git a/[esx_addons]/esx_joblisting/client/main.lua b/[esx_addons]/esx_joblisting/client/main.lua index 995a6cfe..1c1adc5b 100644 --- a/[esx_addons]/esx_joblisting/client/main.lua +++ b/[esx_addons]/esx_joblisting/client/main.lua @@ -39,7 +39,7 @@ Citizen.CreateThread(function() isInMarker = false for i=1, #Config.Zones, 1 do - local distance = GetDistanceBetweenCoords(coords, Config.Zones[i], true) + local distance = #(coords - Config.Zones[i]) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, Config.Zones[i], 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) diff --git a/[esx_addons]/esx_jobs/client/main.lua b/[esx_addons]/esx_jobs/client/main.lua index 6c2def93..56aadabc 100644 --- a/[esx_addons]/esx_jobs/client/main.lua +++ b/[esx_addons]/esx_jobs/client/main.lua @@ -331,13 +331,13 @@ Citizen.CreateThread(function() if (v.Zone) then TriggerEvent("izone:getZoneCenter", v.Zone, function(center) if (not(center == nil)) then - if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, center.x, center.y, center.z, true) < Config.DrawDistance) then + if(v.Marker ~= -1 and #(coords - center) < Config.DrawDistance) then DrawMarker(v.Marker, center.x, center.y, center.z - 1, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false) end end end) else - if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + if(v.Marker ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then DrawMarker(v.Marker, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false) end end @@ -353,7 +353,7 @@ Citizen.CreateThread(function() Citizen.Wait(0) local coords = GetEntityCoords(PlayerPedId()) for k,v in pairs(Config.PublicZones) do - if(v.Marker ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + if(v.Marker ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then DrawMarker(v.Marker, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, false, false, false) end end @@ -369,7 +369,7 @@ Citizen.CreateThread(function() local zone = nil for k,v in pairs(Config.PublicZones) do - if GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x/2 then + if #(coords - v.Pos) < v.Size.x/2 then isInPublicMarker = true position = v.Teleport zone = v @@ -439,7 +439,7 @@ Citizen.CreateThread(function() end -- Else use radius defined from center else - if GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x then + if #(coords - v.Pos) < v.Size.x then isInMarker = true currentZone = k zone = v diff --git a/[esx_addons]/esx_lscustom/client/main.lua b/[esx_addons]/esx_lscustom/client/main.lua index 81cd2b67..a72287e9 100644 --- a/[esx_addons]/esx_lscustom/client/main.lua +++ b/[esx_addons]/esx_lscustom/client/main.lua @@ -387,7 +387,7 @@ Citizen.CreateThread(function() if (ESX.PlayerData.job and ESX.PlayerData.job.name == 'mechanic') or not Config.IsMechanicJobOnly then for k,v in pairs(Config.Zones) do - if GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x and not lsMenuIsShowed then + if #(coords - v.Pos) < v.Size.x and not lsMenuIsShowed then isInLSMarker = true ESX.ShowHelpNotification(v.Hint) break diff --git a/[esx_addons]/esx_mechanicjob/client/main.lua b/[esx_addons]/esx_mechanicjob/client/main.lua index f0abc6ca..40c319a7 100644 --- a/[esx_addons]/esx_mechanicjob/client/main.lua +++ b/[esx_addons]/esx_mechanicjob/client/main.lua @@ -773,7 +773,7 @@ Citizen.CreateThread(function() local coords = GetEntityCoords(PlayerPedId()) local zone = Config.Zones[NPCTargetTowableZone] - if GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCSpawnDistance then + if #(coords - zone.Pos) < Config.NPCSpawnDistance then local model = Config.Vehicles[GetRandomIntInRange(1, #Config.Vehicles)] ESX.Game.SpawnVehicle(model, zone.Pos, 0, function(vehicle) @@ -788,7 +788,7 @@ Citizen.CreateThread(function() local coords = GetEntityCoords(PlayerPedId()) local zone = Config.Zones[NPCTargetTowableZone] - if GetDistanceBetweenCoords(coords, zone.Pos.x, zone.Pos.y, zone.Pos.z, true) < Config.NPCNextToDistance then + if #(coords - zone.Pos) < Config.NPCNextToDistance then ESX.ShowNotification(_U('please_tow')) NPCHasBeenNextToTowable = true end @@ -820,7 +820,7 @@ Citizen.CreateThread(function() local coords, letSleep = GetEntityCoords(PlayerPedId()), true for k,v in pairs(Config.Zones) do - if v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance then + if v.Type ~= -1 and #(coords - v.Pos) < Config.DrawDistance then DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, nil, nil, false) letSleep = false end @@ -847,7 +847,7 @@ Citizen.CreateThread(function() local currentZone = nil for k,v in pairs(Config.Zones) do - if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then + if(#(coords - v.Pos) < v.Size.x) then isInMarker = true currentZone = k end @@ -888,7 +888,7 @@ Citizen.CreateThread(function() if DoesEntityExist(object) then local objCoords = GetEntityCoords(object) - local distance = GetDistanceBetweenCoords(coords, objCoords, true) + local distance = #(coords - objCoords) if closestDistance == -1 or closestDistance > distance then closestDistance = distance diff --git a/[esx_addons]/esx_property/client/main.lua b/[esx_addons]/esx_property/client/main.lua index bc3b2439..12216874 100644 --- a/[esx_addons]/esx_property/client/main.lua +++ b/[esx_addons]/esx_property/client/main.lua @@ -784,7 +784,7 @@ Citizen.CreateThread(function() -- Entering if property.entering and not property.disabled then - local distance = GetDistanceBetweenCoords(coords, property.entering.x, property.entering.y, property.entering.z, true) + local distance = #(coords - property.entering) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, property.entering.x, property.entering.y, property.entering.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false) @@ -803,7 +803,7 @@ Citizen.CreateThread(function() -- Exit if property.exit and not property.disabled then - local distance = GetDistanceBetweenCoords(coords, property.exit.x, property.exit.y, property.exit.z, true) + local distance = #(coords - property.exit) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, property.exit.x, property.exit.y, property.exit.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false) @@ -819,7 +819,7 @@ Citizen.CreateThread(function() -- Room menu if property.roomMenu and hasChest and not property.disabled then - local distance = GetDistanceBetweenCoords(coords, property.roomMenu.x, property.roomMenu.y, property.roomMenu.z, true) + local distance = #(coords - property.roomMenu) if distance < Config.DrawDistance then DrawMarker(Config.MarkerType, property.roomMenu.x, property.roomMenu.y, property.roomMenu.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.RoomMenuMarkerColor.r, Config.RoomMenuMarkerColor.g, Config.RoomMenuMarkerColor.b, 100, false, true, 2, false, nil, nil, false) diff --git a/[esx_addons]/esx_realestateagentjob/client/main.lua b/[esx_addons]/esx_realestateagentjob/client/main.lua index 7efe4c9f..07bbddc9 100644 --- a/[esx_addons]/esx_realestateagentjob/client/main.lua +++ b/[esx_addons]/esx_realestateagentjob/client/main.lua @@ -230,7 +230,7 @@ Citizen.CreateThread(function() local coords = GetEntityCoords(PlayerPedId()) for k,v in pairs(Config.Zones) do - if(v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance) then + if(v.Type ~= -1 and #(coords - v.Pos) < Config.DrawDistance) then DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) end end @@ -247,7 +247,7 @@ Citizen.CreateThread(function() local currentZone = nil for k,v in pairs(Config.Zones) do - if GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x then + if #(coords - v.Pos) < v.Size.x then isInMarker = true currentZone = k end diff --git a/[esx_addons]/esx_taxijob/client/main.lua b/[esx_addons]/esx_taxijob/client/main.lua index 67ccc56d..b27cbee2 100644 --- a/[esx_addons]/esx_taxijob/client/main.lua +++ b/[esx_addons]/esx_taxijob/client/main.lua @@ -500,7 +500,7 @@ Citizen.CreateThread(function() local isInMarker, letSleep, currentZone = false, true for k,v in pairs(Config.Zones) do - local distance = GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) + local distance = #(coords - v.Pos) if v.Type ~= -1 and distance < Config.DrawDistance then letSleep = false diff --git a/[esx_addons]/esx_weaponshop/client/main.lua b/[esx_addons]/esx_weaponshop/client/main.lua index 7abb482f..62e974f6 100644 --- a/[esx_addons]/esx_weaponshop/client/main.lua +++ b/[esx_addons]/esx_weaponshop/client/main.lua @@ -161,7 +161,7 @@ Citizen.CreateThread(function() for k,v in pairs(Config.Zones) do for i = 1, #v.Locations, 1 do - if (Config.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Locations[i], true) < Config.DrawDistance) then + if (Config.Type ~= -1 and #(coords - v.Locations[i]) < Config.DrawDistance) then DrawMarker(Config.Type, v.Locations[i], 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false) end end @@ -178,7 +178,7 @@ Citizen.CreateThread(function() for k,v in pairs(Config.Zones) do for i=1, #v.Locations, 1 do - if GetDistanceBetweenCoords(coords, v.Locations[i], true) < Config.Size.x then + if #(coords - v.Locations[i]) < Config.Size.x then isInMarker, ShopItems, currentZone, LastZone = true, v.Items, k, k end end