mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 22:22:46 +00:00
add package points docs
This commit is contained in:
1 parent
2cca23ad75
commit
8ce5644b8c
2 files changed
+46
No files matched your search
@@ -0,0 +1,40 @@
|
||||
# Points
|
||||
|
||||
Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.
|
||||
|
||||
```lua
|
||||
lib.points.new(coords, distance, data)
|
||||
```
|
||||
|
||||
* coords: `vector3`
|
||||
* distance: `number`
|
||||
* data: `table`
|
||||
|
||||
```lua
|
||||
local point = lib.points.new(playerCoords, 5, {
|
||||
dunak = '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
|
||||
```
|
||||
|
||||
Points can be deleted by using the remove method.
|
||||
|
||||
```lua
|
||||
point:remove()
|
||||
```
|
||||
Reference in new issue
Block a user