mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
1 parent
5850640094
commit
8ca3c1bdfc
21 files changed
+190
-7
No files matched your search
@@ -0,0 +1,17 @@
|
||||
### setMoneyCheck
|
||||
|
||||
Replaces the standard inventory search for "money".
|
||||
|
||||
```lua
|
||||
exports.ox_fuel:setMoneyCheck(function()
|
||||
local accounts = ESX.GetPlayerData().accounts
|
||||
|
||||
for i = 1, #accounts do
|
||||
if accounts[i].name == 'bank' then
|
||||
return accounts[i].money
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
end)
|
||||
```
|
||||
@@ -0,0 +1,20 @@
|
||||
### setPaymentMethod
|
||||
|
||||
Replaces the standard payment method using "money" as an item.
|
||||
|
||||
```lua
|
||||
exports.ox_fuel:setPaymentMethod(function(playerId, amount)
|
||||
local xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
local bankAmount = xPlayer.getAccount('bank').money
|
||||
|
||||
if bankAmount >= amount then
|
||||
xPlayer.removeAccountMoney('bank', amount)
|
||||
return true
|
||||
end
|
||||
|
||||
TriggerClientEvent('ox_lib:notify', source, {
|
||||
type = 'error',
|
||||
description = locale('not_enough_money', amount - bankAmount)
|
||||
})
|
||||
end)
|
||||
```
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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`
|
||||
@@ -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`
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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,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'>
|
||||
|
||||
|
||||
@@ -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'>
|
||||
|
||||
|
||||
@@ -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,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:
|
||||
|
||||
|
||||
@@ -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
|
||||
```
|
||||
@@ -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.
@@ -1,4 +1,4 @@
|
||||
The input for zones differs slightly from all other options, instead taking the [zone](../../ox_lib/Zones/Client.md) properties and two additional properties (drawSprite, and options).
|
||||
The input for zones differs slightly from all other options, instead taking the [zone](../../ox_lib/Zones/Shared.md) properties and two additional properties (drawSprite, and options).
|
||||
|
||||
## addSphereZone
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ Inserts a new entry into the database and returns the insert id for the row, if
|
||||
```lua
|
||||
-- alias: exports.oxmysql:insert
|
||||
-- alias: MySQL.Async.insert
|
||||
-- alias: exports.ghmattimysql:execute
|
||||
|
||||
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id)
|
||||
print(id)
|
||||
@@ -20,6 +21,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:insert_async
|
||||
-- alias: MySQL.Sync.insert
|
||||
-- alias: exports.ghmattimysql:executeSync
|
||||
|
||||
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
|
||||
print(id)
|
||||
|
||||
@@ -10,6 +10,7 @@ When selecting data it will return all matching rows and columns, otherwise it w
|
||||
```lua
|
||||
-- alias: exports.oxmysql:query
|
||||
-- alias: MySQL.Async.query
|
||||
-- alias: exports.ghmattimysql:execute
|
||||
|
||||
MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
@@ -26,6 +27,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:query_async
|
||||
-- alias: MySQL.Sync.query
|
||||
-- alias: exports.ghmattimysql:executeSync
|
||||
|
||||
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
|
||||
@@ -9,6 +9,7 @@ Returns the first column for a single row.
|
||||
```lua
|
||||
-- alias: exports.oxmysql:scalar
|
||||
-- alias: MySQL.Async.fetchScalar
|
||||
-- alias: exports.ghmattimysql:scalar
|
||||
|
||||
MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
|
||||
print(firstname)
|
||||
@@ -20,6 +21,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:scalar_async
|
||||
-- alias: MySQL.Sync.fetchScalar
|
||||
-- alias: exports.ghmattimysql:scalarSync
|
||||
|
||||
local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
print(firstname)
|
||||
|
||||
@@ -22,6 +22,7 @@ local queries = {
|
||||
```lua
|
||||
-- alias: exports.oxmysql:transaction
|
||||
-- alias: MySQL.Async.transaction
|
||||
-- alias: exports.ghmattimysql:transaction
|
||||
|
||||
MySQL.transaction(queries, function(success)
|
||||
print(success)
|
||||
@@ -33,6 +34,8 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:transaction_async
|
||||
-- alias: MySQL.Sync.transaction
|
||||
-- alias: exports.ghmattimysql:transactionSync
|
||||
|
||||
local success = MySQL.transaction.await(queries)
|
||||
print(success)
|
||||
```
|
||||
|
||||
@@ -9,6 +9,7 @@ Returns the number of affected rows by the query.
|
||||
```lua
|
||||
-- alias: exports.oxmysql:update
|
||||
-- alias: MySQL.Async.execute
|
||||
-- alias: exports.ghmattimysql:execute
|
||||
|
||||
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}, function(affectedRows)
|
||||
if affectedRows then
|
||||
@@ -22,6 +23,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:update_async
|
||||
-- alias: MySQL.Sync.execute
|
||||
-- alias: exports.ghmattimysql:executeSync
|
||||
|
||||
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
|
||||
Reference in new issue
Block a user