v2.1.0
Feature
Implement the "points" API to perform simple optimised distance checks.
- Trigger a callback when leaving, entering, or within range of a "point".
- The "nearby" callback is triggered on-frame, so it can be used for drawing text, markers, etc.
--@coords vector3
--@distance number
--@data table
local point = lib.points.new(coords, 5, {
dunak = 'is a nerd',
})
function point:onEnter()
print('entered range of point', self.id)
end
function point:onExit()
print('left range of point', self.id)
end
function point:nearby()
DrawMarker(2, self.coords.x, self.coords.y, self.coords.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 200, 20, 20, 50, false, true, 2, nil, nil, false)
if self.currentDistance < 1 and IsControlJustReleased(0, 38) then
print('inside marker', self.id)
print(self.dunak)
end
end
Tweaks
Minor performance tweak to cache.
cache.seat will update when shuffling (previously required re-entering a vehicle).
Extra error handling.
Full Changelog: v2.0.1...v2.1.0