mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
Add sample code for lib.points
This commit is contained in:
1 parent
45f4376c68
commit
3089b963c5
2 files changed
+32
-1
No files matched your search
@@ -0,0 +1,31 @@
|
|||||||
|
# Points
|
||||||
|
|
||||||
|
Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- coords: vector3
|
||||||
|
-- distance: number
|
||||||
|
-- data: table
|
||||||
|
lib.points.new(coords, distance, data)
|
||||||
|
|
||||||
|
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:callback()
|
||||||
|
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
|
||||||
|
```
|
||||||
@@ -5,7 +5,7 @@ Check if a resource is using a specified version or higher, allowing for compati
|
|||||||
```lua
|
```lua
|
||||||
-- repository: string
|
-- repository: string
|
||||||
-- version: string
|
-- version: string
|
||||||
lib.versionCheck(repository, version)
|
lib.checkDependency(repository, version)
|
||||||
|
|
||||||
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
||||||
```
|
```
|
||||||
Reference in new issue
Block a user