Merge pull request #1443 from Kenshiin13/points-module

fix(client/modules/points): Small improvements.
This commit is contained in:
Kasey Fitton
2024-11-09 08:50:05 +00:00
committed by GitHub
2 changed files with 8 additions and 9 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ function Point:constructor(properties)
self.inside = properties.inside or function() end
self.enter = properties.enter or function() end
self.leave = properties.leave or function() end
self.handle = ESX.CreatePointIntenal(properties.coords, properties.distance, properties.hidden, function()
self.handle = ESX.CreatePointInternal(properties.coords, properties.distance, properties.hidden, function()
self.nearby = true
if self.enter then
self:enter()
+7 -8
View File
@@ -1,6 +1,6 @@
local points = {}
function ESX.CreatePointIntenal(coords, distance, hidden, enter, leave)
function ESX.CreatePointInternal(coords, distance, hidden, enter, leave)
local point = {
coords = coords,
distance = distance,
@@ -28,8 +28,7 @@ function StartPointsLoop()
CreateThread(function()
while true do
local coords = GetEntityCoords(ESX.PlayerData.ped)
for i=1, #points do
local point = points[i]
for i, point in pairs(points) do
local distance = #(coords - point.coords)
if not point.hidden and distance <= point.distance then
@@ -50,9 +49,9 @@ end
AddEventHandler('onResourceStop', function(resource)
for i=1, #points do
if points[i].resource == resource then
points[i] = nil
end
end
for i, point in pairs(points) do
if point.resource == resource then
points[i] = nil
end
end
end)