mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
complete js/ts docs
This commit is contained in:
1 parent
c7a4aca477
commit
e3293c2109
5 files changed
+194
-22
No files matched your search
@@ -74,7 +74,7 @@ lib.addPrincipal(child, parent)
|
||||
lib.addPrincipal('player.1', 'group.moderator')
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='js/ts'>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/server'
|
||||
|
||||
+100
-10
@@ -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
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
-- dict: string
|
||||
-- timeout: number [default: 100]
|
||||
lib.requestAnimDict(dict, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestAnimDict(dict, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* dict: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
### lib.requestAnimSet
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
-- set: string
|
||||
-- timeout: number [default: 100]
|
||||
lib.requestAnimSet(set, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestAnimSet(set, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* set: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
|
||||
### lib.requestModel
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
-- model: string
|
||||
-- timeout: number [default: 100]
|
||||
lib.requestModel(model, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestModel(model, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* model: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
### lib.requestStreamedTextureDict
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
-- dict: string
|
||||
-- timeout: number [default: 100]
|
||||
lib.requestStreamedTextureDict(dict, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestStreamedTextureDict(dict, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* dict: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
|
||||
### lib.requestNamedPtfxAsset
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
-- fxName: string
|
||||
-- timeout: number [default: 100]
|
||||
lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.requestNamedPtfxAsset(fxName, timeout)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
* fxName: `string`
|
||||
* timeout: `number`
|
||||
* Default: `100`
|
||||
|
||||
@@ -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`
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId()))
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId()))
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
### 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`)
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
RegisterNetEvent('ox_lib:setVehicleProperties', function(netid, data)
|
||||
lib.setVehicleProperties(NetToVeh(netid), data)
|
||||
end)
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/client'
|
||||
|
||||
onNet('ox_lib:setVehicleProperties', (netid, data) => {
|
||||
lib.setVehicleProperties(NetToVeh(netid), data)
|
||||
})
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
|
||||
#### Recommended usage
|
||||
The server should tell the owner of the entity to set properties, using the following trigger.
|
||||
|
||||
@@ -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`
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
lib.versionCheck('overextended/ox_lib')
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/server'
|
||||
|
||||
lib.versionCheck('overextended/ox_lib')
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
[Utilises GitHub's release API](https://docs.github.com/en/rest/reference/releases)
|
||||
@@ -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`
|
||||
|
||||
<Tabs>
|
||||
<TabItem value='Lua'>
|
||||
|
||||
```lua
|
||||
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value='JS/TS'>
|
||||
|
||||
```ts
|
||||
import lib from '@overextended/ox_lib/shared'
|
||||
// import { checkDependency } from '@overextended/ox_lib/shared'
|
||||
|
||||
if (!lib.checkDependency('ox_lib', '1.5.0')) error()
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
||||
Reference in new issue
Block a user