diff --git a/[core]/esx_lib/imports/points/client.lua b/[core]/esx_lib/imports/points/client.lua index 4f140438..bdaca8f0 100644 --- a/[core]/esx_lib/imports/points/client.lua +++ b/[core]/esx_lib/imports/points/client.lua @@ -57,8 +57,11 @@ function xLib.points.startLoop() while true do local coords = GetEntityCoords(PlayerPedId()) - for _, point in pairs(insidePoints) do - point.inside(#(coords - point.coords)) + for handle, point in pairs(insidePoints) do + if not pcall(point.inside, #(coords - point.coords)) then + insidePoints[handle] = nil + print(("[^1ERROR^7] point ^5%s^7 from ^5%s^7 errored on inside"):format(handle, point.resource)) + end end local now = GetGameTimer() @@ -70,8 +73,8 @@ function xLib.points.startLoop() if not point.nearby then point.nearby = true - if point.enter then - point.enter() + if point.enter and not pcall(point.enter) then + print(("[^1ERROR^7] point ^5%s^7 from ^5%s^7 errored on enter"):format(handle, point.resource)) end if point.inside then @@ -81,8 +84,8 @@ function xLib.points.startLoop() elseif point.nearby then point.nearby = false - if point.leave then - point.leave() + if point.leave and not pcall(point.leave) then + print(("[^1ERROR^7] point ^5%s^7 from ^5%s^7 errored on leave"):format(handle, point.resource)) end insidePoints[handle] = nil