Merge branch 'lib-update' into main

This commit is contained in:
Linden committed 2023-05-22 07:20:31 +10:00
commit ba0b798808
8 files changed
+148 -5

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
### lib.getClosestObject
Get the object handle and coords of the closest object to a set of coordinates.
```lua
lib.getClosestObject(coords, maxDistance)
```
* coords: `vector3`
* The coords to check from.
* maxDistance: `number`
* The max distance to check.
Return:
* ped?: `number`
* coords?: `number`
+17
View File
@@ -0,0 +1,17 @@
### lib.getClosestPed
Get the ped handle and coords of the closest ped to a set of coordinates.
```lua
lib.getClosestPed(coords, maxDistance)
```
* coords: `vector3`
* The coords to check from.
* maxDistance: `number`
* The max distance to check.
Return:
* ped?: `number`
* coords?: `number`
+16
View File
@@ -0,0 +1,16 @@
### lib.getNearbyObjects
Get the object handle and coords of all objects within range of a set of coordinates.
```lua
lib.getNearbyObjects(coords, maxDistance)
```
* coords: `vector3`
* The coords to check from.
* maxDistance: `number`
* The max distance to check.
Return:
* `{ object: number, coords: vector3 }[]`
+16
View File
@@ -0,0 +1,16 @@
### lib.getNearbyPeds
Get the ped handle and coords of all peds within range of a set of coordinates.
```lua
lib.getNearbyPeds(coords, maxDistance)
```
* coords: `vector3`
* The coords to check from.
* maxDistance: `number`
* The max distance to check.
Return:
* `{ ped: number, coords: vector3 }[]`
+1 -1
View File
@@ -15,4 +15,4 @@ lib.getNearbyPlayers(coords, maxDistance, includePlayer)
Return:
* `number[]`
* `{ id: number, ped: number, coords: vector3 }[]`
+1 -1
View File
@@ -15,4 +15,4 @@ lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle)
Return:
* `number[]`
* `{ vehicle: number, coords: vector3 }[]`
+9 -3
View File
@@ -110,7 +110,10 @@ lib.notify({
position = 'top',
style = {
backgroundColor = '#141517',
color = '#909296'
color = '#C1C2C5',
['.description'] = {
color = '#909296'
}
},
icon = 'ban',
iconColor = '#C53030'
@@ -130,7 +133,10 @@ lib.notify({
position: 'top',
style: {
backgroundColor: '#141517',
color: '#909296'
color: '#C1C2C5',
'.decription': {
color: '#909296',
},
},
icon: 'ban',
iconColor: '#C53030'
@@ -140,4 +146,4 @@ lib.notify({
</TabItem>
</Tabs>
![custom_notification](https://i.imgur.com/wcjqIlw.png)
![custom_notification](https://i.imgur.com/WpqiW5f.png)
+71
View File
@@ -0,0 +1,71 @@
## lib.math
Extends the standard Lua math table with extra functions.
```
math = lib.math
```
### math.toscalars
Takes a string and returns a set of scalar values.
```lua
math.toscalars(input, min, max, round)
```
- input: `string`
- min?: `number`
- max?: `number`
- round?: `boolean`
Return:
- ...: `number`
### math.tovector
Takes a string or table and returns a vector value, or a number if only one value was found.
```lua
math.tovector(input, min, max, round)
```
- input: `string` or `table`
- min?: `number`
- max?: `number`
- round?: `boolean`
Return:
- value: `number` or `vector2` or `vector3` or `vector4`
### math.torgba
Takes a string or table and returns a vector value, or a number if only one value was found.
Values are rounded and must be within the range of 0-255.
```lua
math.torgba(input)
```
- input: `string` or `table`
Return:
- value: `number` or `vector2` or `vector3` or `vector4`
### math.tohex
Takes a number or string and formats it as a hexadecimal string.
```lua
math.tohex(n, upper)
```
- n: `number` or `string`
- upper?: `boolean`
Return:
- hex: `string`