mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 22:22:46 +00:00
use same params and types format for all of lib
This commit is contained in:
1 parent
e3293c2109
commit
6c2ab8f8ec
14 files changed
+114
-67
No files matched your search
@@ -1,11 +1,13 @@
|
|||||||
```lua
|
```lua
|
||||||
-- principal: string or string[] or false
|
|
||||||
-- command: string
|
|
||||||
-- callback: function
|
|
||||||
-- parameters: table (optional)
|
|
||||||
-- help: string (optional)
|
|
||||||
lib.addCommand(principal, command, callback, parameters, help)
|
lib.addCommand(principal, command, callback, parameters, help)
|
||||||
|
```
|
||||||
|
* principal: `string` or `string[]` or `false`
|
||||||
|
* command: `string`
|
||||||
|
* callback: `function`
|
||||||
|
* parameters?: `table` (`array`)
|
||||||
|
* help?: `string`
|
||||||
|
|
||||||
|
```lua
|
||||||
lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args)
|
lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args)
|
||||||
args.item = Items(args.item)
|
args.item = Items(args.item)
|
||||||
if args.item and args.count > 0 then
|
if args.item and args.count > 0 then
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ Triggers a registered server callback and registers an event handler for the res
|
|||||||
### lib.callback
|
### lib.callback
|
||||||
The response is handled in a separate coroutine.
|
The response is handled in a separate coroutine.
|
||||||
```lua
|
```lua
|
||||||
-- name: string
|
|
||||||
-- delay: number or false
|
|
||||||
-- cb: function
|
|
||||||
lib.callback(name, delay, cb, ...)
|
lib.callback(name, delay, cb, ...)
|
||||||
|
```
|
||||||
|
* name: `string`
|
||||||
|
* delay: `number` or `false`
|
||||||
|
* cb: `function`
|
||||||
|
* ...: `any`
|
||||||
|
|
||||||
|
```lua
|
||||||
lib.callback('ox_inventory:getItemCount', false, function(count)
|
lib.callback('ox_inventory:getItemCount', false, function(count)
|
||||||
print(count)
|
print(count)
|
||||||
end, 'water', {type = 'fresh'})
|
end, 'water', {type = 'fresh'})
|
||||||
@@ -16,10 +19,13 @@ end, 'water', {type = 'fresh'})
|
|||||||
### lib.callback.await
|
### lib.callback.await
|
||||||
The current coroutine is yielded until a response is received.
|
The current coroutine is yielded until a response is received.
|
||||||
```lua
|
```lua
|
||||||
-- name: string
|
|
||||||
-- delay: number or false
|
|
||||||
lib.callback.await(name, delay, ...)
|
lib.callback.await(name, delay, ...)
|
||||||
|
```
|
||||||
|
* name: `string`
|
||||||
|
* delay: `number` or `false`
|
||||||
|
* ...: `any`
|
||||||
|
|
||||||
|
```lua
|
||||||
local count = lib.callback.await('ox_inventory:getItemCount', false, 'water', {type = 'fresh'})
|
local count = lib.callback.await('ox_inventory:getItemCount', false, 'water', {type = 'fresh'})
|
||||||
print(count)
|
print(count)
|
||||||
```
|
```
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
### lib.callback.register
|
### lib.callback.register
|
||||||
```lua
|
```lua
|
||||||
-- name: string
|
|
||||||
-- cb: function
|
|
||||||
lib.callback.register(name, cb)
|
lib.callback.register(name, cb)
|
||||||
|
```
|
||||||
|
* name: `string`
|
||||||
|
* cb: `function`
|
||||||
|
|
||||||
|
```lua
|
||||||
lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target)
|
lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target)
|
||||||
local inventory = target and Inventory(target) or Inventory(source)
|
local inventory = target and Inventory(target) or Inventory(source)
|
||||||
return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0
|
return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
### lib.disableControls
|
### lib.disableControls
|
||||||
|
Call on frame to disable all stored keys.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- Call on frame to disable all stored keys.
|
|
||||||
lib.disableControls()
|
lib.disableControls()
|
||||||
```
|
```
|
||||||
|
|
||||||
### lib.disableControls:Add
|
### lib.disableControls:Add
|
||||||
```lua
|
```lua
|
||||||
-- vararg: number
|
|
||||||
lib.disableControls:Add(...)
|
lib.disableControls:Add(...)
|
||||||
```
|
```
|
||||||
|
* vararg: `number`
|
||||||
|
|
||||||
### lib.disableControls:Remove
|
### lib.disableControls:Remove
|
||||||
```lua
|
```lua
|
||||||
-- vararg: number
|
|
||||||
lib.disableControls:Remove(...)
|
lib.disableControls:Remove(...)
|
||||||
```
|
```
|
||||||
|
* vararg: `number`
|
||||||
|
|
||||||
### lib.disableControls:Clear
|
### lib.disableControls:Clear
|
||||||
```lua
|
```lua
|
||||||
-- vararg: number
|
|
||||||
lib.disableControls:Clear(...)
|
lib.disableControls:Clear(...)
|
||||||
```
|
```
|
||||||
|
* vararg: `number`
|
||||||
@@ -3,11 +3,16 @@
|
|||||||
Get the id, ped, and coords of the closest player to a set of coordinates.
|
Get the id, ped, and coords of the closest player to a set of coordinates.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param coords vector3 The coords to check from.
|
|
||||||
---@param maxDistance number The max distance to check.
|
|
||||||
---@param includePlayer boolean Whether or not to include the current player.
|
|
||||||
---@return number? playerId
|
|
||||||
---@return number? playerPed
|
|
||||||
---@return vector3? playerCoords
|
|
||||||
function lib.getClosestPlayer(coords, maxDistance, includePlayer) end
|
function lib.getClosestPlayer(coords, maxDistance, includePlayer) end
|
||||||
```
|
```
|
||||||
|
* coords: `vector3`
|
||||||
|
* The coords to check from.
|
||||||
|
* maxDistance: `number`
|
||||||
|
* The max distance to check.
|
||||||
|
* includePlayer: `boolean`
|
||||||
|
* Whether or not to include the current player.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
* playerId?: `number`
|
||||||
|
* playerPed?: `nubmer`
|
||||||
|
* playerCoords?: `vector3`
|
||||||
@@ -3,10 +3,16 @@
|
|||||||
Get the id and coords of the closest vehicle to a set of coordinates.
|
Get the id and coords of the closest vehicle to a set of coordinates.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param coords vector3 The coords to check from.
|
|
||||||
---@param maxDistance number The max distance to check.
|
|
||||||
---@param includePlayerVehicle boolean Whether or not to include the player's current vehicle.
|
|
||||||
---@return number? vehicle
|
|
||||||
---@return vector3? vehicleCoords
|
|
||||||
function lib.getClosestVehicle(coords, maxDistance, includePlayerVehicle) end
|
function lib.getClosestVehicle(coords, maxDistance, includePlayerVehicle) end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* coords: `vector3`
|
||||||
|
* The coords to check from.
|
||||||
|
* maxDistance: `number`
|
||||||
|
* The max distance to check.
|
||||||
|
* includePlayerVehicle: `boolean`
|
||||||
|
* Whether or not to include the player's current vehicle.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
* vehicle?: `number`
|
||||||
|
* vehicleCoords?: `vector3`
|
||||||
@@ -3,9 +3,14 @@
|
|||||||
Get the id, ped, and coords of all players within range of a set of coordinates.
|
Get the id, ped, and coords of all players within range of a set of coordinates.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param coords vector3 The coords to check from.
|
|
||||||
---@param maxDistance number The max distance to check.
|
|
||||||
---@param includePlayer boolean Whether or not to include the current player.
|
|
||||||
---@return number[]
|
|
||||||
function lib.getNearbyPlayers(coords, maxDistance, includePlayer) end
|
function lib.getNearbyPlayers(coords, maxDistance, includePlayer) end
|
||||||
```
|
```
|
||||||
|
* coords: `vector3`
|
||||||
|
* The coords to check from.
|
||||||
|
* maxDistance: `number`
|
||||||
|
* The max distance to check.
|
||||||
|
* includePlayer: `boolean`
|
||||||
|
* Whether or not to include the current player.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
* `number[]`
|
||||||
@@ -3,9 +3,14 @@
|
|||||||
Get the id and coords of all vehicles within range of a set of coordinates.
|
Get the id and coords of all vehicles within range of a set of coordinates.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param coords vector3 The coords to check from.
|
|
||||||
---@param maxDistance number The max distance to check.
|
|
||||||
---@param includePlayerVehicle boolean Whether or not to include the player's current vehicle.
|
|
||||||
---@return number[]
|
|
||||||
function lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle) end
|
function lib.getNearbyVehicles(coords, maxDistance, includePlayerVehicle) end
|
||||||
```
|
```
|
||||||
|
* coords: `vector3`
|
||||||
|
* The coords to check from.
|
||||||
|
* maxDistance: `number`
|
||||||
|
* The max distance to check.
|
||||||
|
* includePlayerVehicle: `boolean`
|
||||||
|
* Whether or not to include the player's current vehicle.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
* `number[]`
|
||||||
@@ -4,11 +4,12 @@ Locale files should use the [ISO Language Code](http://www.lingoes.net/en/transl
|
|||||||
Players can use `setlocale [langcode]`, and admins can use `serverlocale [langcode]` to change the loaded file.
|
Players can use `setlocale [langcode]`, and admins can use `serverlocale [langcode]` to change the loaded file.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- str: string
|
|
||||||
-- ...: string | number
|
|
||||||
locale(str, ...)
|
locale(str, ...)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* str: `string`
|
||||||
|
* ...: `string` or `number`
|
||||||
|
|
||||||
Additional arguments can be sent to format the locale output.
|
Additional arguments can be sent to format the locale output.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
|
|||||||
@@ -12,12 +12,13 @@ set datadog:site "datadoghq.com"
|
|||||||
```
|
```
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- source: string | number
|
|
||||||
-- event: string
|
|
||||||
-- message: string
|
|
||||||
-- ...: string
|
|
||||||
lib.logger(source, event, message, ...)
|
lib.logger(source, event, message, ...)
|
||||||
```
|
```
|
||||||
|
* source: `string` or `number`
|
||||||
|
* event: `string`
|
||||||
|
* message: `string`
|
||||||
|
* ...: `string`
|
||||||
|
|
||||||
|
|
||||||
Source is passed to ddsource and creates a tag. Could be playerId, identifier, -1, or server.
|
Source is passed to ddsource and creates a tag. Could be playerId, identifier, -1, or server.
|
||||||
Event is passed to ddservice and displays in the logs list.
|
Event is passed to ddservice and displays in the logs list.
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.
|
Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- coords: vector3
|
|
||||||
-- distance: number
|
|
||||||
-- data: table
|
|
||||||
lib.points.new(coords, distance, data)
|
lib.points.new(coords, distance, data)
|
||||||
|
```
|
||||||
|
* coords: `vector3`
|
||||||
|
* distance: `number`
|
||||||
|
* data: `table`
|
||||||
|
|
||||||
|
```lua
|
||||||
local point = lib.points.new(playerCoords, 5, {
|
local point = lib.points.new(playerCoords, 5, {
|
||||||
dunak = 'nerd',
|
dunak = 'nerd',
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,12 +3,16 @@
|
|||||||
Starts a shapetest originating from the camera, extending to ~10m.
|
Starts a shapetest originating from the camera, extending to ~10m.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
---@param flags number? Defaults to 1|2|8|16 (see: https://docs.fivem.net/natives/?_0x377906D8A31E5586)
|
|
||||||
---@param p8 number? A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
|
|
||||||
---@return boolean hit
|
|
||||||
---@return number entityHit
|
|
||||||
---@return vector3 endCoords
|
|
||||||
---@return vector3 surfaceNormal
|
|
||||||
---@return number materialHash
|
|
||||||
function lib.raycast.cam(flags, p8) end
|
function lib.raycast.cam(flags, p8) end
|
||||||
```
|
```
|
||||||
|
* flags?: `number`
|
||||||
|
* Defaults to 1|2|8|16 (see: https://docs.fivem.net/natives/?_0x377906D8A31E5586)
|
||||||
|
* p8?: `numbe`
|
||||||
|
* A bit mask with bits 1, 2, 4, or 7 relating to collider types. 4 and 7 are usually used.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
* hit: `boolean`
|
||||||
|
* entityHit: `number`
|
||||||
|
* endCoords: `vector3`
|
||||||
|
* surfaceNormal: `vector3`
|
||||||
|
* materialHash: `number`
|
||||||
@@ -51,8 +51,6 @@ lib.requestAnimSet(set, timeout)
|
|||||||
* timeout: `number`
|
* timeout: `number`
|
||||||
* Default: `100`
|
* Default: `100`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### lib.requestModel
|
### lib.requestModel
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
|
|||||||
+23
-13
@@ -1,25 +1,35 @@
|
|||||||
An alternative to PolyZone utilising [glm.polygon](https://github.com/gottfriedleibniz/lua/blob/luaglm/EXTENDED.md#polygon).
|
An alternative to PolyZone utilising [glm.polygon](https://github.com/gottfriedleibniz/lua/blob/luaglm/EXTENDED.md#polygon).
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- data: table
|
|
||||||
-- points: vector3[] all z values must match
|
|
||||||
-- thickness: number (optional), default 4
|
|
||||||
-- debug: bool (optional)
|
|
||||||
lib.zones.poly(data)
|
lib.zones.poly(data)
|
||||||
|
```
|
||||||
|
* data: `table`
|
||||||
|
* points: `vector3[]`
|
||||||
|
* All z values must match
|
||||||
|
* thickness?: `number`
|
||||||
|
* Default: `4`
|
||||||
|
* debug?: `boolean`
|
||||||
|
|
||||||
-- data: table
|
```lua
|
||||||
-- coords: vector3
|
|
||||||
-- size: vector3 (optional), default is vec3(4, 4, 4)
|
|
||||||
-- rotation: number (optional), angle in degrees
|
|
||||||
-- debug: bool (optional)
|
|
||||||
lib.zones.box(data)
|
lib.zones.box(data)
|
||||||
|
```
|
||||||
|
* data: `table`
|
||||||
|
* coords: `vector3`
|
||||||
|
* size?: `vector3`
|
||||||
|
* Default: `vec3(4, 4, 4)`
|
||||||
|
* rotation?: `number`
|
||||||
|
* Angle in degrees
|
||||||
|
* debug?: `boolean`
|
||||||
|
|
||||||
-- data: table
|
|
||||||
-- coords: vector3
|
```lua
|
||||||
-- radius: number (optional), default is 2
|
|
||||||
-- debug: bool (optional)
|
|
||||||
lib.zones.sphere(data)
|
lib.zones.sphere(data)
|
||||||
```
|
```
|
||||||
|
* data: `table`
|
||||||
|
* coords: `vector3`
|
||||||
|
* radius?: `number`
|
||||||
|
* Default: `2`
|
||||||
|
* debug?: `boolean`
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
function onEnter(self)
|
function onEnter(self)
|
||||||
|
|||||||
Reference in new issue
Block a user