lib updates up to 3.5.0

This commit is contained in:
Linden committed 2023-05-22 07:20:18 +10:00
1 parent 5486bf3e88
commit 6815e4fbac
7 files changed
+139 -2

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 }[]`
+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`