Points

The points system lets you define coordinate-based trigger zones. When a player enters, exits, or stays near a point, callbacks fire automatically.


Creating a Point

local point = KOJA.Client.points.new(properties)

Properties

Field
Type
Required
Description

coords

vector3

Yes

Centre of the zone

distance

number

Yes

Radius in metres

onEnter

function(self)

No

Called once when the player enters the zone

onExit

function(self)

No

Called once when the player exits the zone

nearby

function(self)

No

Called repeatedly (every ~300 ms) while the player is inside

Any additional fields you add become properties of the point object and are accessible in callbacks via self.

Returns CPoint — the point object.


Point Object

Property / Method
Description

point.id

Unique numeric ID

point.coords

vector3 position

point.distance

Radius

point.currentDistance

Distance from the player right now (only set when nearby)

point.isClosest

true when this is the closest active point

point:remove()

Removes the point and clears all callbacks


Examples

Simple Enter/Exit

Recurring Nearby Check

Custom Properties

Removing a Point


Static Methods


SetInterval / ClearInterval

The points module also exposes interval helpers for recurring tasks.


Resource Cleanup

Points created by a resource are automatically removed when that resource stops. No manual cleanup is needed.

Last updated