Update for docs (#116)

* Update for docs

* More changes and fix
This commit is contained in:
Maciej Ratyński authored and GitHub committed 2023-04-21 00:07:57 +10:00
1 parent 5850640094
commit 8ca3c1bdfc
21 files changed
+190 -7

No files matched your search

+2
View File
@@ -24,6 +24,8 @@ An interval runs every 100ms to update data that cannot be checked via handlers.
- current player coords
- only populated if using `zones` or `points`
- cannot be listened for with `onCache`
- mount: `number` or `false` (RedM only)
- mount entity id
## lib.onCache
+16
View File
@@ -0,0 +1,16 @@
### lib.cron.new
Creates a new [cronjob](https://en.wikipedia.org/wiki/Cron), scheduling a task to run at fixed times or intervals.
Supports numbers, any value `*`, lists `1,2,3`, ranges `1-3`, and steps `*/4`.
Day of the week is a range of `1-7` starting from Sunday and allows short-names (i.e. sun, mon, tue).
```lua
lib.cron.new(expression, job, options)
```
* expression:
* string A cron expression such as `* * * * *` representing minute, hour, day, month, and day of the week
* job:
* fun(task: `OxTask`, date: `osdate`)
* options?:
* debug?: `boolean`
+1 -1
View File
@@ -3,7 +3,7 @@
Get the id, ped, and coords of the closest player to a set of coordinates.
```lua
function lib.getClosestPlayer(coords, maxDistance, includePlayer) end
lib.getClosestPlayer(coords, maxDistance, includePlayer)
```
* coords: `vector3`
+1 -1
View File
@@ -3,7 +3,7 @@
Get the id and coords of the closest vehicle to a set of coordinates.
```lua
function lib.getClosestVehicle(coords, maxDistance, includePlayerVehicle) end
lib.getClosestVehicle(coords, maxDistance, includePlayerVehicle)
```
* coords: `vector3`
+1 -1
View File
@@ -3,7 +3,7 @@
Get the id, ped, and coords of all players within range of a set of coordinates.
```lua
function lib.getNearbyPlayers(coords, maxDistance, includePlayer) end
lib.getNearbyPlayers(coords, maxDistance, includePlayer)
```
* coords: `vector3`
+1 -1
View File
@@ -3,7 +3,7 @@
Get the id and coords of all vehicles within range of a set of coordinates.
```lua
function lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle) end
lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle)
```
* coords: `vector3`
+13
View File
@@ -13,10 +13,23 @@ Returns whether the player pressed the confirm button or canceled the dialog.
<Tabs>
<TabItem value='Lua'>
<Tabs>
<TabItem value='Client'>
```lua
lib.alertDialog(data)
```
</TabItem>
<TabItem value='Server'>
```lua
TriggerClientEvent('ox_lib:alertDialog', source, data)
```
</TabItem>
</Tabs>
</TabItem>
<TabItem value='JS/TS'>
+13
View File
@@ -12,10 +12,23 @@ Custom notifications with a lot of styling options.
<Tabs>
<TabItem value='Lua'>
<Tabs>
<TabItem value='Client'>
```lua
lib.notify(data)
```
</TabItem>
<TabItem value='Server'>
```lua
TriggerClientEvent('ox_lib:notify', source, data)
```
</TabItem>
</Tabs>
</TabItem>
<TabItem value='JS/TS'>
+1
View File
@@ -38,6 +38,7 @@ lib.addRadialItem(items)
* Id of a menu to open.
* onSelect: `function(currentMenu: string | nil, itemIndex: number)` | `string`
* Function that's ran when a user clicks the item.
* keepOpen?: `boolean`
### lib.removeRadialItem
+3 -2
View File
@@ -3,13 +3,14 @@
Starts a shapetest originating from the camera, extending to ~10m.
```lua
function lib.raycast.cam(flags, p8) end
lib.raycast.cam(flags, ignore, distance)
```
* flags?: `number`
* Defaults to 1|2|8|16 (see: https://docs.fivem.net/natives/?_0x377906D8A31E5586)
* p8?: `number`
* ignore?: `number`
* A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
* distance?: `number`
Return:
+55
View File
@@ -153,3 +153,58 @@ lib.requestScaleformMovie(scaleformMovie, timeout)
* dict: `string`
* timeout: `number`
* Default: `100`
### lib.requestWeaponAsset
<Tabs>
<TabItem value='Lua'>
```lua
lib.requestWeaponAsset(weaponType, timeout, weaponResourceFlags, extraWeaponComponentFlags)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.requestWeaponAsset(weaponType, timeout, weaponResourceFlags, extraWeaponComponentFlags)
```
</TabItem>
</Tabs>
* weaponType: `string | number`
* timeout: `number?`
* Number of ticks to wait for the asset to load. Default is `500`
* weaponResourceFlags: `WeaponResourceFlags?`
* Default is `31`
* extraWeaponComponentFlags: `ExtraWeaponComponentFlags?`
* Default is `0`
Return:
* `string | number?` weaponType
### WeaponResourceFlags
```
1 WRF_REQUEST_BASE_ANIMS
2 WRF_REQUEST_COVER_ANIMS
4 WRF_REQUEST_MELEE_ANIMS
8 WRF_REQUEST_MOTION_ANIMS
16 WRF_REQUEST_STEALTH_ANIMS
32 WRF_REQUEST_ALL_MOVEMENT_VARIATION_ANIMS
31 WRF_REQUEST_ALL_ANIMS
```
### ExtraWeaponComponentFlags
```
0 WEAPON_COMPONENT_NONE
1 WEAPON_COMPONENT_FLASH
2 WEAPON_COMPONENT_SCOPE
4 WEAPON_COMPONENT_SUPP
8 WEAPON_COMPONENT_SCLIP2
16 WEAPON_COMPONENT_GRIP
```
+34
View File
@@ -0,0 +1,34 @@
## lib.table.contains
```lua
lib.table.contains(table, value)
```
* table: `table`
* value: `any`
## lib.table.matches
```lua
lib.table.matches(tableOne, tableTwo)
```
* tableOne: `table`.
* tableTwo: `table`
## lib.table.deepclone
```lua
lib.table.deepclone(table)
```
* table: `table`
## lib.table.merge
```lua
lib.table.merge(tableOne, tableTwo)
```
* tableOne: `table`
* tableTwo: `table`
File renamed without changes.