From e3293c210959010fb76c88cb73f1d282305335a1 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 17 Sep 2022 13:03:31 +0200 Subject: [PATCH] complete js/ts docs --- docs/ox_lib/ACL/Server.md | 2 +- docs/ox_lib/Streaming/Client.md | 110 +++++++++++++++++++++--- docs/ox_lib/VehicleProperties/Client.md | 53 ++++++++++-- docs/ox_lib/Version/Server.md | 21 ++++- docs/ox_lib/Version/Shared.md | 30 ++++++- 5 files changed, 194 insertions(+), 22 deletions(-) diff --git a/docs/ox_lib/ACL/Server.md b/docs/ox_lib/ACL/Server.md index 843c9527..4df250b1 100644 --- a/docs/ox_lib/ACL/Server.md +++ b/docs/ox_lib/ACL/Server.md @@ -74,7 +74,7 @@ lib.addPrincipal(child, parent) lib.addPrincipal('player.1', 'group.moderator') ``` - + ```ts import lib from '@overextended/ox_lib/server' diff --git a/docs/ox_lib/Streaming/Client.md b/docs/ox_lib/Streaming/Client.md index 1ed3caef..8ce6d4ae 100644 --- a/docs/ox_lib/Streaming/Client.md +++ b/docs/ox_lib/Streaming/Client.md @@ -1,37 +1,127 @@ Check if assets exist, such as models, and loads them into memory. Throws errors for invalid assets and returns true if the asset is loaded. +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ### lib.requestAnimDict + + + + ```lua --- dict: string --- timeout: number [default: 100] lib.requestAnimDict(dict, timeout) ``` + + + +```ts +import lib from '@overextended/ox_lib/client' + +lib.requestAnimDict(dict, timeout) +``` + + + +* dict: `string` +* timeout: `number` + * Default: `100` + ### lib.requestAnimSet + + + + ```lua --- set: string --- timeout: number [default: 100] lib.requestAnimSet(set, timeout) ``` + + + +```ts +import lib from '@overextended/ox_lib/client' + +lib.requestAnimSet(set, timeout) +``` + + + +* set: `string` +* timeout: `number` + * Default: `100` + + ### lib.requestModel + + + + ```lua --- model: string --- timeout: number [default: 100] lib.requestModel(model, timeout) ``` + + + +```ts +import lib from '@overextended/ox_lib/client' + +lib.requestModel(model, timeout) +``` + + + +* model: `string` +* timeout: `number` + * Default: `100` + ### lib.requestStreamedTextureDict + + + + ```lua --- dict: string --- timeout: number [default: 100] lib.requestStreamedTextureDict(dict, timeout) ``` + + + +```ts +import lib from '@overextended/ox_lib/client' + +lib.requestStreamedTextureDict(dict, timeout) +``` + + + +* dict: `string` +* timeout: `number` + * Default: `100` + ### lib.requestNamedPtfxAsset + + + + ```lua --- fxName: string --- timeout: number [default: 100] +lib.requestNamedPtfxAsset(fxName, timeout) + +``` + + + +```ts +import lib from '@overextended/ox_lib/client' + lib.requestNamedPtfxAsset(fxName, timeout) ``` + + + +* fxName: `string` +* timeout: `number` + * Default: `100` + diff --git a/docs/ox_lib/VehicleProperties/Client.md b/docs/ox_lib/VehicleProperties/Client.md index 69c748ed..7071cacc 100644 --- a/docs/ox_lib/VehicleProperties/Client.md +++ b/docs/ox_lib/VehicleProperties/Client.md @@ -1,25 +1,66 @@ Mostly follows the format used by ESX and QBCore, with extra data such as damaged/missing props. https://github.com/overextended/ox_lib/blob/master/resource/vehicleProperties/client.lua#L5 +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ### lib.getVehicleProperties -```lua --- vehicle: entity + + +```ts lib.getVehicleProperties(vehicle) +``` +* vehicle: `entity` + + + + +```lua +lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId())) +``` + + + +```ts +import lib from '@overextended/ox_lib/client' lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId())) ``` + + + ### lib.setVehicleProperties Requires the vehicle to belong to the client. _Do not use NetworkRequestControlOfEntity_. -```lua --- vehicle: entity --- props: table -lib.setVehicleProperties(vehicle, props) +```lua +lib.setVehicleProperties(vehicle, props) +``` +* vehicle: `entity` +* props: `table` (`object`) + + + + +```lua RegisterNetEvent('ox_lib:setVehicleProperties', function(netid, data) lib.setVehicleProperties(NetToVeh(netid), data) end) ``` + + + +```ts +import lib from '@overextended/ox_lib/client' + +onNet('ox_lib:setVehicleProperties', (netid, data) => { + lib.setVehicleProperties(NetToVeh(netid), data) +}) +``` + + + + #### Recommended usage The server should tell the owner of the entity to set properties, using the following trigger. diff --git a/docs/ox_lib/Version/Server.md b/docs/ox_lib/Version/Server.md index 7702e51e..731e2d86 100644 --- a/docs/ox_lib/Version/Server.md +++ b/docs/ox_lib/Version/Server.md @@ -1,10 +1,29 @@ ### lib.versionCheck Compares the resource version to the latest published release on GitHub. + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ```lua --- repository: string lib.versionCheck(repository) +``` +* repository: `string` + + + + +```lua +lib.versionCheck('overextended/ox_lib') +``` + + + +```ts +import lib from '@overextended/ox_lib/server' lib.versionCheck('overextended/ox_lib') ``` + + [Utilises GitHub's release API](https://docs.github.com/en/rest/reference/releases) diff --git a/docs/ox_lib/Version/Shared.md b/docs/ox_lib/Version/Shared.md index b11f15d4..07328b5b 100644 --- a/docs/ox_lib/Version/Shared.md +++ b/docs/ox_lib/Version/Shared.md @@ -1,9 +1,31 @@ ### lib.checkDependency Check if a resource is using a specified version or higher, allowing for compatibility checks or throwing errors. -```lua --- resource: string --- version: string -lib.checkDependency(resource, version) +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +```lua +lib.checkDependency(resource, version) +``` +* resource: `string` +* version: `string` + + + + +```lua if not lib.checkDependency('ox_lib', '1.5.0') then error() end ``` + + + +```ts +import lib from '@overextended/ox_lib/shared' +// import { checkDependency } from '@overextended/ox_lib/shared' + +if (!lib.checkDependency('ox_lib', '1.5.0')) error() +``` + + + +