Points
Proximity points with enter / exit / nearby callbacks and closest-point tracking — sharing one tick.
Proximity points with enter / exit / nearby callbacks and closest-point tracking — sharing one tick.
lib.points creates proximity points that fire onEnter / onExit / nearby callbacks and
track which one is isClosest. Like zones, they all share a single tick. Callbacks are
client-side; the server exposes lookups.
local point = lib.points.new({
coords = vector3(215.0, -810.0, 30.0),
radius = 5.0,
onEnter = function(self) lib.print.info('near', self.id) end,
onExit = function(self) lib.print.info('away', self.id) end,
nearby = function(self)
if self.isClosest and IsControlJustPressed(0, 38) then
print('E on the closest point')
end
end,
})
point.remove()coordsvector3requiredThe point position.
radiusnumberoptionalDetection radius. Default 10.0.
onEnterfun(self)optionalFired when the player enters the radius.
onExitfun(self)optionalFired when the player leaves the radius.
nearbyfun(self)optionalFired every frame while inside. self.isClosest is true for the single nearest active point.
lib.points.getPlayerDistance(source, pointId) returns the distance (or nil), and
lib.points.isPlayerNearPoint(source, pointId) is a boolean.
Callbacks are client-only. Enter / exit runs every ~300 ms; nearby runs at frame rate. Only one point is isClosest globally (not per group). Always :remove() a point you no longer need.