From 6c2ab8f8ec1bc53f7ec2609e599c0e1833dfd01d Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 17 Sep 2022 13:25:20 +0200 Subject: [PATCH] use same params and types format for all of lib --- docs/ox_lib/AddCommand/Server.md | 12 +++++---- docs/ox_lib/Callback/Client.md | 16 +++++++---- docs/ox_lib/Callback/Server.md | 6 +++-- docs/ox_lib/DisableControls/Client.md | 10 +++---- docs/ox_lib/GetClosestPlayer/Client.md | 17 +++++++----- docs/ox_lib/GetClosestVehicle/Client.md | 16 +++++++---- docs/ox_lib/GetNearbyPlayers/Client.md | 13 ++++++--- docs/ox_lib/GetNearbyVehicles/Client.md | 13 ++++++--- docs/ox_lib/Locale/Shared.md | 5 ++-- docs/ox_lib/Logger/Server.md | 9 ++++--- docs/ox_lib/Points/Client.md | 8 +++--- docs/ox_lib/Raycast/Client.md | 18 ++++++++----- docs/ox_lib/Streaming/Client.md | 2 -- docs/ox_lib/Zones/Client.md | 36 ++++++++++++++++--------- 14 files changed, 114 insertions(+), 67 deletions(-) diff --git a/docs/ox_lib/AddCommand/Server.md b/docs/ox_lib/AddCommand/Server.md index 25a267b3..18280d92 100644 --- a/docs/ox_lib/AddCommand/Server.md +++ b/docs/ox_lib/AddCommand/Server.md @@ -1,11 +1,13 @@ ```lua --- principal: string or string[] or false --- command: string --- callback: function --- parameters: table (optional) --- help: string (optional) 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) args.item = Items(args.item) if args.item and args.count > 0 then diff --git a/docs/ox_lib/Callback/Client.md b/docs/ox_lib/Callback/Client.md index a8e5d223..c20c5772 100644 --- a/docs/ox_lib/Callback/Client.md +++ b/docs/ox_lib/Callback/Client.md @@ -3,11 +3,14 @@ Triggers a registered server callback and registers an event handler for the res ### lib.callback The response is handled in a separate coroutine. ```lua --- name: string --- delay: number or false --- cb: function lib.callback(name, delay, cb, ...) +``` +* name: `string` +* delay: `number` or `false` +* cb: `function` +* ...: `any` +```lua lib.callback('ox_inventory:getItemCount', false, function(count) print(count) end, 'water', {type = 'fresh'}) @@ -16,10 +19,13 @@ end, 'water', {type = 'fresh'}) ### lib.callback.await The current coroutine is yielded until a response is received. ```lua --- name: string --- delay: number or false 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'}) print(count) ``` diff --git a/docs/ox_lib/Callback/Server.md b/docs/ox_lib/Callback/Server.md index ba650162..ebd29dec 100644 --- a/docs/ox_lib/Callback/Server.md +++ b/docs/ox_lib/Callback/Server.md @@ -1,9 +1,11 @@ ### lib.callback.register ```lua --- name: string --- cb: function lib.callback.register(name, cb) +``` +* name: `string` +* cb: `function` +```lua lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target) local inventory = target and Inventory(target) or Inventory(source) return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0 diff --git a/docs/ox_lib/DisableControls/Client.md b/docs/ox_lib/DisableControls/Client.md index 65e1121d..6d912916 100644 --- a/docs/ox_lib/DisableControls/Client.md +++ b/docs/ox_lib/DisableControls/Client.md @@ -1,23 +1,23 @@ ### lib.disableControls +Call on frame to disable all stored keys. + ```lua --- Call on frame to disable all stored keys. lib.disableControls() ``` - ### lib.disableControls:Add ```lua --- vararg: number lib.disableControls:Add(...) ``` +* vararg: `number` ### lib.disableControls:Remove ```lua --- vararg: number lib.disableControls:Remove(...) ``` +* vararg: `number` ### lib.disableControls:Clear ```lua --- vararg: number lib.disableControls:Clear(...) ``` +* vararg: `number` diff --git a/docs/ox_lib/GetClosestPlayer/Client.md b/docs/ox_lib/GetClosestPlayer/Client.md index 26f88915..e54d6f58 100644 --- a/docs/ox_lib/GetClosestPlayer/Client.md +++ b/docs/ox_lib/GetClosestPlayer/Client.md @@ -3,11 +3,16 @@ Get the id, ped, and coords of the closest player to a set of coordinates. ```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 ``` +* 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` diff --git a/docs/ox_lib/GetClosestVehicle/Client.md b/docs/ox_lib/GetClosestVehicle/Client.md index b5a6acaf..1b39dcae 100644 --- a/docs/ox_lib/GetClosestVehicle/Client.md +++ b/docs/ox_lib/GetClosestVehicle/Client.md @@ -3,10 +3,16 @@ Get the id and coords of the closest vehicle to a set of coordinates. ```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 ``` + +* 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` diff --git a/docs/ox_lib/GetNearbyPlayers/Client.md b/docs/ox_lib/GetNearbyPlayers/Client.md index 65c1ebc1..f8eadde6 100644 --- a/docs/ox_lib/GetNearbyPlayers/Client.md +++ b/docs/ox_lib/GetNearbyPlayers/Client.md @@ -3,9 +3,14 @@ Get the id, ped, and coords of all players within range of a set of coordinates. ```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 ``` +* 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[]` diff --git a/docs/ox_lib/GetNearbyVehicles/Client.md b/docs/ox_lib/GetNearbyVehicles/Client.md index cd342e12..ed960198 100644 --- a/docs/ox_lib/GetNearbyVehicles/Client.md +++ b/docs/ox_lib/GetNearbyVehicles/Client.md @@ -3,9 +3,14 @@ Get the id and coords of all vehicles within range of a set of coordinates. ```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 ``` +* 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[]` diff --git a/docs/ox_lib/Locale/Shared.md b/docs/ox_lib/Locale/Shared.md index 7239b799..8f8d262c 100644 --- a/docs/ox_lib/Locale/Shared.md +++ b/docs/ox_lib/Locale/Shared.md @@ -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. ```lua --- str: string --- ...: string | number locale(str, ...) ``` +* str: `string` +* ...: `string` or `number` + Additional arguments can be sent to format the locale output. ```lua diff --git a/docs/ox_lib/Logger/Server.md b/docs/ox_lib/Logger/Server.md index 974af2e0..61ab5907 100644 --- a/docs/ox_lib/Logger/Server.md +++ b/docs/ox_lib/Logger/Server.md @@ -12,12 +12,13 @@ set datadog:site "datadoghq.com" ``` ```lua --- source: string | number --- event: string --- message: string --- ...: string 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. Event is passed to ddservice and displays in the logs list. diff --git a/docs/ox_lib/Points/Client.md b/docs/ox_lib/Points/Client.md index ae3070f9..48db351c 100644 --- a/docs/ox_lib/Points/Client.md +++ b/docs/ox_lib/Points/Client.md @@ -3,11 +3,13 @@ Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates. ```lua --- coords: vector3 --- distance: number --- data: table lib.points.new(coords, distance, data) +``` +* coords: `vector3` +* distance: `number` +* data: `table` +```lua local point = lib.points.new(playerCoords, 5, { dunak = 'nerd', }) diff --git a/docs/ox_lib/Raycast/Client.md b/docs/ox_lib/Raycast/Client.md index ab2cc1ea..1edb1481 100644 --- a/docs/ox_lib/Raycast/Client.md +++ b/docs/ox_lib/Raycast/Client.md @@ -3,12 +3,16 @@ Starts a shapetest originating from the camera, extending to ~10m. ```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 ``` +* 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` diff --git a/docs/ox_lib/Streaming/Client.md b/docs/ox_lib/Streaming/Client.md index 8ce6d4ae..77bebbc4 100644 --- a/docs/ox_lib/Streaming/Client.md +++ b/docs/ox_lib/Streaming/Client.md @@ -51,8 +51,6 @@ lib.requestAnimSet(set, timeout) * timeout: `number` * Default: `100` - - ### lib.requestModel diff --git a/docs/ox_lib/Zones/Client.md b/docs/ox_lib/Zones/Client.md index 057764cc..7da5b91f 100644 --- a/docs/ox_lib/Zones/Client.md +++ b/docs/ox_lib/Zones/Client.md @@ -1,25 +1,35 @@ An alternative to PolyZone utilising [glm.polygon](https://github.com/gottfriedleibniz/lua/blob/luaglm/EXTENDED.md#polygon). ```lua --- data: table - -- points: vector3[] all z values must match - -- thickness: number (optional), default 4 - -- debug: bool (optional) lib.zones.poly(data) +``` +* data: `table` + * points: `vector3[]` + * All z values must match + * thickness?: `number` + * Default: `4` + * debug?: `boolean` --- data: table - -- coords: vector3 - -- size: vector3 (optional), default is vec3(4, 4, 4) - -- rotation: number (optional), angle in degrees - -- debug: bool (optional) +```lua 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 - -- radius: number (optional), default is 2 - -- debug: bool (optional) + +```lua lib.zones.sphere(data) ``` +* data: `table` + * coords: `vector3` + * radius?: `number` + * Default: `2` + * debug?: `boolean` ```lua function onEnter(self)