chore(intellisense): improve parameter annotations and add missing comments

Touched up incorrect or missing Intellisense parameter annotations across several functions. Added some missing descriptions to improve editor support. Still more to do, but this is a small step forward for overall developer workflow. Also small fix in picklexp
This commit is contained in:
MrNewb committed 2025-06-07 22:50:13 -04:00
1 parent 866283162b
commit c71a261115
88 files changed
+339 -286

No files matched your search

+3 -3
View File
@@ -22,9 +22,9 @@ Clothing.SetAppearance = function(src, data)
end
--- Sets a player's appearance based on gender-specific data
--- @param src number The server ID of the player
--- @param data table Table containing separate appearance data for male and female characters
--- @return table|nil Appearance updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table Table containing separate appearance data for male and female characters
---@return table|nil Appearance updated player appearance data or nil if failed
function Clothing.SetAppearanceExt(src, data)
local tbl = Clothing.IsMale(src) and data.male or data.female
Clothing.SetAppearance(src, tbl)
+1 -1
View File
@@ -1,4 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
Clothing = Clothing or {}
+30 -28
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -6,9 +7,9 @@ Callback = Callback or Require("lib/utility/shared/callbacks.lua")
Table = Table or Require('lib/utility/shared/tables.lua')
ESX = ESX or exports['es_extended']:getSharedObject()
--- Internal function to get the full appearance data including skin, model, and converted format
--- @param src number The server ID of the player
--- @return table|nil The player's full appearance data or nil if not found
---Internal function to get the full appearance data including skin, model, and converted format
---@param src number The server ID of the player
---@return table|nil The player's full appearance data or nil if not found
function Clothing.GetFullAppearanceData(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -36,10 +37,10 @@ function Clothing.GetFullAppearanceData(src)
return Clothing.Players[citId]
end
--- Retrieves a player's converted appearance data for easy use across modules
--- @param src number The server ID of the player
--- @param fullData boolean Optional - If true, returns the full data object including skin and model
--- @return table|nil The player's converted appearance data or full appearance data if fullData=true
---Retrieves a player's converted appearance data for easy use across modules
---@param src number The server ID of the player
---@param fullData boolean Optional - If true, returns the full data object including skin and model
---@return table|nil The player's converted appearance data or full appearance data if fullData=true
function Clothing.GetAppearance(src, fullData)
if fullData then
return Clothing.GetFullAppearanceData(src)
@@ -49,7 +50,8 @@ function Clothing.GetAppearance(src, fullData)
return completeData.converted
end
---This will save the player's current appearance to the database
---@param src number|string
function Clothing.Save(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -66,11 +68,11 @@ function Clothing.Save(src)
citId
})
end
--- Sets a player's appearance based on the provided data
--- @param src number The server ID of the player
--- @param data table The appearance data to apply
--- @param updateBackup boolean Whether to update the backup appearance data
--- @return table|nil The updated player appearance data or nil if failed
---Sets a player's appearance based on the provided data
---@param src number The server ID of the player
---@param data table The appearance data to apply
---@param updateBackup boolean Whether to update the backup appearance data
---@return table|nil The updated player appearance data or nil if failed
function Clothing.SetAppearance(src, data, updateBackup, save)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -113,17 +115,17 @@ function Clothing.SetAppearance(src, data, updateBackup, save)
end
--- Sets a player's appearance based on gender-specific data
--- @param src number The server ID of the player
--- @param data table Table containing separate appearance data for male and female characters
--- @return table|nil Appearance updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table Table containing separate appearance data for male and female characters
---@return table|nil Appearance updated player appearance data or nil if failed
function Clothing.SetAppearanceExt(src, data)
local tbl = Clothing.IsMale(src) and data.male or data.female
Clothing.SetAppearance(src, tbl)
end
--- Reverts a player's appearance to their backup appearance
--- @param src number The server ID of the player
--- @return boolean|nil Returns true if successful or nil if failed
---Reverts a player's appearance to their backup appearance
---@param src number The server ID of the player
---@return boolean|nil Returns true if successful or nil if failed
function Clothing.Revert(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -134,15 +136,16 @@ function Clothing.Revert(src)
return Clothing.SetAppearance(src, backup)
end
---This will open the menu for the passed src
---@param src number|string
function Clothing.OpenMenu(src)
src = src and tonumber(src)
assert(src, "src is nil")
TriggerClientEvent('esx_skin:openMenu', src)
end
--- Event handler for when a player loads into the server
--- Caches the player's appearance data
---Event handler for when a player loads into the server
---Caches the player's appearance data
AddEventHandler('community_bridge:Server:OnPlayerLoaded', function(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -150,8 +153,8 @@ AddEventHandler('community_bridge:Server:OnPlayerLoaded', function(src)
Clothing.GetFullAppearanceData(src)
end)
--- Event handler for when a player disconnects from the server
--- Removes the player's appearance data from the cache
---Event handler for when a player disconnects from the server
---Removes the player's appearance data from the cache
AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -161,8 +164,8 @@ end)
--- Event handler for when the resource starts
--- Caches appearance data for all currently connected players
---Event handler for when the resource starts
---Caches appearance data for all currently connected players
AddEventHandler('onResourceStart', function(resource)
if resource ~= GetCurrentResourceName() then return end
for _, playerId in ipairs(GetPlayers()) do
@@ -174,13 +177,12 @@ AddEventHandler('onResourceStart', function(resource)
end
end)
--- Callback handler for retrieving a player's appearance data
---Callback handler for retrieving a player's appearance data
Callback.Register('community_bridge:cb:GetAppearance', function(source)
local src = source
return Clothing.GetAppearance(src)
end)
RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source
Clothing.SetAppearance(src, {
+7 -7
View File
@@ -1,4 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
Clothing = Clothing or {}
@@ -91,14 +91,14 @@ end
function Props.ConvertFromDefault(defaultProps)
local returnProps = {}
for index, propData in pairs(defaultProps or {}) do
for index, propData in pairs(defaultProps or {}) do
local propId = Props.Map[propData.prop_id]
if propId then
returnProps[propId .. '_1'] = propData.drawable
returnProps[propId .. '_2'] = propData.texture
returnProps[propId .. '_2'] = propData.texture
end
end
return returnProps
return returnProps
end
function Props.ConvertToDefault(esxProps)
@@ -115,14 +115,14 @@ function Props.ConvertToDefault(esxProps)
returnProps[propId] = returnProps[propId] or {}
returnProps[propId].prop_id = propId
returnProps[propId].drawable = propData
returnProps[propId].texture = returnProps[propId].texture or 0
returnProps[propId].texture = returnProps[propId].texture or 0
end
end
table.sort(returnProps, function(a, b)
return a.prop_id < b.prop_id
end)
end
return returnProps
return returnProps
end
function Clothing.ConvertFromDefault(defaultClothing)
@@ -131,7 +131,7 @@ function Clothing.ConvertFromDefault(defaultClothing)
for propsIndex, propData in pairs(props) do
components[propsIndex] = propData
end
end
return components --skin
end
+1 -1
View File
@@ -1,4 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end
Clothing = Clothing or {}
+15 -14
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -6,8 +7,8 @@ Callback = Callback or Require("lib/utility/shared/callbacks.lua")
Table = Table or Require('lib/utility/shared/tables.lua')
--- Internal function to get the full appearance data including skin, model, and converted format
--- @param src number The server ID of the player
--- @return table|nil The player's full appearance data or nil if not found
---@param src number The server ID of the player
---@return table|nil The player's full appearance data or nil if not found
function Clothing.GetFullAppearanceData(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -34,9 +35,9 @@ function Clothing.GetFullAppearanceData(src)
end
--- Retrieves a player's converted appearance data for easy use across modules
--- @param src number The server ID of the player
--- @param fullData boolean Optional - If true, returns the full data object including skin and model
--- @return table|nil The player's converted appearance data or full appearance data if fullData=true
---@param src number The server ID of the player
---@param fullData boolean Optional - If true, returns the full data object including skin and model
---@return table|nil The player's converted appearance data or full appearance data if fullData=true
function Clothing.GetAppearance(src, fullData)
if fullData then
return Clothing.GetFullAppearanceData(src)
@@ -47,10 +48,10 @@ function Clothing.GetAppearance(src, fullData)
end
--- Sets a player's appearance based on the provided data
--- @param src number The server ID of the player
--- @param data table The appearance data to apply
--- @param updateBackup boolean Whether to update the backup appearance data
--- @return table|nil The updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table The appearance data to apply
---@param updateBackup boolean Whether to update the backup appearance data
---@return table|nil The updated player appearance data or nil if failed
function Clothing.SetAppearance(src, data, updateBackup, save)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -89,17 +90,17 @@ function Clothing.SetAppearance(src, data, updateBackup, save)
end
--- Sets a player's appearance based on gender-specific data
--- @param src number The server ID of the player
--- @param data table Table containing separate appearance data for male and female characters
--- @return table|nil Appearance updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table Table containing separate appearance data for male and female characters
---@return table|nil Appearance updated player appearance data or nil if failed
function Clothing.SetAppearanceExt(src, data)
local tbl = Clothing.IsMale(src) and data.male or data.female
Clothing.SetAppearance(src, tbl)
end
--- Reverts a player's appearance to their backup appearance
--- @param src number The server ID of the player
--- @return boolean|nil Returns true if successful or nil if failed
---@param src number The server ID of the player
---@return boolean|nil Returns true if successful or nil if failed
function Clothing.Revert(src)
src = src and tonumber(src)
local currentClothing = Clothing.GetFullAppearanceData(src)
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end
Clothing = Clothing or {}
+15 -14
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -6,8 +7,8 @@ Callback = Callback or Require("lib/utility/shared/callbacks.lua")
Table = Table or Require('lib/utility/shared/tables.lua')
--- Internal function to get the full appearance data including skin, model, and converted format
--- @param src number The server ID of the player
--- @return table|nil The player's full appearance data or nil if not found
---@param src number The server ID of the player
---@return table|nil The player's full appearance data or nil if not found
function Clothing.GetFullAppearanceData(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -34,9 +35,9 @@ function Clothing.GetFullAppearanceData(src)
end
--- Retrieves a player's converted appearance data for easy use across modules
--- @param src number The server ID of the player
--- @param fullData boolean Optional - If true, returns the full data object including skin and model
--- @return table|nil The player's converted appearance data or full appearance data if fullData=true
---@param src number The server ID of the player
---@param fullData boolean Optional - If true, returns the full data object including skin and model
---@return table|nil The player's converted appearance data or full appearance data if fullData=true
function Clothing.GetAppearance(src, fullData)
if fullData then
return Clothing.GetFullAppearanceData(src)
@@ -47,10 +48,10 @@ function Clothing.GetAppearance(src, fullData)
end
--- Sets a player's appearance based on the provided data
--- @param src number The server ID of the player
--- @param data table The appearance data to apply
--- @param updateBackup boolean Whether to update the backup appearance data
--- @return table|nil The updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table The appearance data to apply
---@param updateBackup boolean Whether to update the backup appearance data
---@return table|nil The updated player appearance data or nil if failed
function Clothing.SetAppearance(src, data, updateBackup, save)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -89,17 +90,17 @@ function Clothing.SetAppearance(src, data, updateBackup, save)
end
--- Sets a player's appearance based on gender-specific data
--- @param src number The server ID of the player
--- @param data table Table containing separate appearance data for male and female characters
--- @return table|nil Appearance updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table Table containing separate appearance data for male and female characters
---@return table|nil Appearance updated player appearance data or nil if failed
function Clothing.SetAppearanceExt(src, data)
local tbl = Clothing.IsMale(src) and data.male or data.female
Clothing.SetAppearance(src, tbl)
end
--- Reverts a player's appearance to their backup appearance
--- @param src number The server ID of the player
--- @return boolean|nil Returns true if successful or nil if failed
---@param src number The server ID of the player
---@return boolean|nil Returns true if successful or nil if failed
function Clothing.Revert(src)
src = src and tonumber(src)
assert(src, "src is nil")
+2 -3
View File
@@ -1,8 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
TriggerEvent('qb-clothing:client:openMenu')
end
end
+18 -19
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -7,8 +8,8 @@ Table = Table or Require('lib/utility/shared/tables.lua')
QBCore = QBCore or exports['qb-core']:GetCoreObject() -- probably easiest for now to call the Framework module
--- Internal function to get the full appearance data including skin, model, and converted format
--- @param src number The server ID of the player
--- @return table|nil The player's full appearance data or nil if not found
---@param src number The server ID of the player
---@return table|nil The player's full appearance data or nil if not found
function Clothing.GetFullAppearanceData(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -37,9 +38,9 @@ function Clothing.GetFullAppearanceData(src)
end
--- Retrieves a player's converted appearance data for easy use across modules
--- @param src number The server ID of the player
--- @param fullData boolean Optional - If true, returns the full data object including skin and model
--- @return table|nil The player's converted appearance data or full appearance data if fullData=true
---@param src number The server ID of the player
---@param fullData boolean Optional - If true, returns the full data object including skin and model
---@return table|nil The player's converted appearance data or full appearance data if fullData=true
function Clothing.GetAppearance(src, fullData)
if fullData then
return Clothing.GetFullAppearanceData(src)
@@ -50,10 +51,10 @@ function Clothing.GetAppearance(src, fullData)
end
--- Sets a player's appearance based on the provided data
--- @param src number The server ID of the player
--- @param data table The appearance data to apply
--- @param updateBackup boolean Whether to update the backup appearance data
--- @return table|nil The updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table The appearance data to apply
---@param updateBackup boolean Whether to update the backup appearance data
---@return table|nil The updated player appearance data or nil if failed
function Clothing.SetAppearance(src, data, updateBackup, save)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -94,17 +95,17 @@ function Clothing.SetAppearance(src, data, updateBackup, save)
end
--- Sets a player's appearance based on gender-specific data
--- @param src number The server ID of the player
--- @param data table Table containing separate appearance data for male and female characters
--- @return table|nil Appearance updated player appearance data or nil if failed
---@param src number The server ID of the player
---@param data table Table containing separate appearance data for male and female characters
---@return table|nil Appearance updated player appearance data or nil if failed
function Clothing.SetAppearanceExt(src, data)
local tbl = Clothing.IsMale(src) and data.male or data.female
Clothing.SetAppearance(src, tbl)
end
--- Reverts a player's appearance to their backup appearance
--- @param src number The server ID of the player
--- @return boolean|nil Returns true if successful or nil if failed
---@param src number The server ID of the player
---@return boolean|nil Returns true if successful or nil if failed
function Clothing.Revert(src)
src = src and tonumber(src)
assert(src, "src is nil")
@@ -145,8 +146,6 @@ AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
Clothing.Players[strSrc] = nil
end)
--- Event handler for when the resource starts
--- Caches appearance data for all currently connected players
AddEventHandler('onResourceStart', function(resource)
@@ -166,7 +165,7 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source)
return Clothing.GetAppearance(src)
end)
--[[
RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source
Clothing.SetAppearance(src, {
@@ -206,7 +205,7 @@ RegisterCommand('clothing:openmenu', function(source, args, rawCommand)
local src = source
Clothing.OpenMenu(src)
end, false)
--]]
-- RegisterCommand('clothing:crowley', function(source, args, rawCommand)
-- local src = source
@@ -236,4 +235,4 @@ end, false)
-- -- {drawable = 0, prop_id = 7, texture = 0},
-- }
-- }, false, true)
-- end, false)
-- end, false)
+2 -2
View File
@@ -92,7 +92,7 @@ end
function Props.ConvertToDefault(qbProps)
local returnProps = {}
for propIndex, propData in pairs(qbProps or {}) do
for propIndex, propData in pairs(qbProps or {}) do
local propId = Props.InverseMap[propIndex]
if propId then
table.insert(returnProps, {
@@ -114,7 +114,7 @@ function Clothing.ConvertFromDefault(defaultClothing)
for propsIndex, propData in pairs(props) do
components[propsIndex] = propData
end
end
return components --skin
end
+3 -3
View File
@@ -36,9 +36,9 @@ function Dialogue.Close(name)
end
--- Open a dialogue with the player
--- @param name string
--- @param dialogue string
--- @param options table example = {{ id = string, label = string}}
---@param name string
---@param dialogue string
---@param options table example = {{ id = string, label = string}}
function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSelected)
assert(name, "Name is required")
assert(dialogue, "Dialogue is required")
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Dispatch = Dispatch or {}
---This will send an alert to currently supported dispatch systems.
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('bub-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('cd_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
+2 -1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('lb-tablet') == 'missing' then return end
Dispatch = Dispatch or {}
@@ -13,7 +14,7 @@ local function getPriorityLevel(priority)
end
end
---commentThis will send an alert to the passed jobs
---This will send an alert to the passed jobs
---@param data table
Dispatch.SendAlert = function(data)
local streetName, _ = Utility.GetStreetNameAtCoords(data.coords)
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('linden_outlawalert') == 'missing' then return end
Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('ps-dispatch') == 'missing' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qs-dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('redutzu-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('tk_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Doorlock = Doorlock or {}
---This will get the closest door to the ped
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "BigDaddy-Fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "cdn-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "esx-sna-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "LegacyFuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "okokGasStation"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ps-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qs-fuelstations"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "Renewed-Fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ti_fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "x-fuel"
if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
---This will show a help text message at the screen position passed
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
---This will show a help text message to the specified player at the screen position passed
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
local resourceName = "cd_drawtextui"
local configValue = BridgeSharedConfig.HelpText
@@ -8,14 +9,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return TriggerEvent('cd_drawtextui:ShowUI', 'show', message)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return TriggerEvent('cd_drawtextui:HideUI')
end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
local resourceName = "jg-textui"
local configValue = BridgeSharedConfig.HelpText
@@ -7,14 +8,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return exports['jg-textui']:DrawText(message)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports['jg-textui']:HideText()
end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
local resourceName = "lab-HintUI"
local configValue = BridgeSharedConfig.HelpText
@@ -7,14 +8,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return exports['lab-HintUI']:Show(message, "Hint Text")
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports['lab-HintUI']:Hide()
end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
local resourceName = "okokTextUI"
local configValue = BridgeSharedConfig.HelpText
@@ -7,14 +8,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string
---@param _position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position)
return exports['okokTextUI']:Open(message, 'darkblue', _position, false)
end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports['okokTextUI']:Close()
end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
local resourceName = "ox_lib"
local configValue = BridgeSharedConfig.HelpText
@@ -7,7 +8,6 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string
---@param position string
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, position)
return exports.ox_lib:showTextUI(message, {
position = position or 'top-center'
@@ -16,7 +16,6 @@ end
---This will hide the help text message on the screen
---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function()
return exports.ox_lib:hideTextUI()
end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qb-input"
local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_lib"
local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end
+16 -8
View File
@@ -34,12 +34,16 @@ Inventory.AddTrunkItems = function(identifier, items)
return false, Prints.Error("This Inventory Has Not Been Bridged For A Trunk Feature.")
end
---This will clear the specified inventory, will return success or failure.
---@param id string
---@return boolean
Inventory.ClearStash = function(id, _type)
if type(id) ~= "string" then return false end
return false, Prints.Error("This Inventory Has Not Been Bridged For A ClearStash Feature.")
end
---This will return a table with the item info, {name, label, stack, weight, description, image}
---This will return a table with the item info,
---example: {name = "coolitem", label = "a cool item name", stack = false, weight = 1000, description = "some item description", image = "coolitem.png"}
---@param item string
---@return table
Inventory.GetItemInfo = function(item)
@@ -47,8 +51,8 @@ Inventory.GetItemInfo = function(item)
end
---This will return the count of the item in the players inventory, if not found will return 0.
---
---if metadata is passed it will find the matching items count.
---example: 0
---@param src number
---@param item string
---@param metadata table
@@ -58,6 +62,7 @@ Inventory.GetItemCount = function(src, item, metadata)
end
---This wil return the players inventory.
---example: {{weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}, {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 2, label = "stinky", count = 1}}
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src)
@@ -65,8 +70,7 @@ Inventory.GetPlayerInventory = function(src)
end
---Returns the specified slot data as a table.
---
---format {weight, name, metadata, slot, label, count}
---example {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}
---@param src number
---@param slot number
---@return table
@@ -152,10 +156,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, Prints.Error("This Inventory Has Not Been Bridged For A CreateShop Feature.")
end
@@ -167,6 +171,10 @@ Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135"
end
---This will remove the file extension from the item name if present.
---example: "item.png" will become "item"
---@param item string
---@return string
Inventory.StripPNG = function(item)
if string.find(item, ".png") then
item = string.gsub(item, ".png", "")
+4 -4
View File
@@ -193,10 +193,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return true, print("Unable to Create Shop for codem-inventory, I do not have access to a copy of this inventory to bridge the feature.")
end
+8 -12
View File
@@ -52,7 +52,6 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
end
---This will return the count of the item in the players inventory, if not found will return 0.
---
---if metadata is passed it will find the matching items count.
---@param src number
---@param item string
@@ -110,7 +109,6 @@ Inventory.GetPlayerInventory = function(src)
end
---Returns the specified slot data as a table.
---
---format {weight, name, metadata, slot, label, count}
---@param src number
---@param slot number
@@ -175,7 +173,6 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
groups = groups,
coords = coords
}
--core:openInventory(nil, id, 'stash', mathyShit, mathyShit, false, nil, false)
return true, id
end
@@ -246,25 +243,24 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end
-- This will open the specified shop for the src passed.
---This will open the specified shop for the src passed.
---@param src number
---@param shopTitle string
Inventory.OpenShop = function(src, shopTitle)
return false, print("Unable to open shop for core_inventory, I do not have access to a copy of this inventory to bridge the feature.")
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---This will register a shop, if it already exists it will return true.
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, print("Unable to open shop for core_inventory, I do not have access to a copy of this inventory to bridge the feature.")
end
--<-- TODO swap to internal callback system
-- This is used for the esx users, documentation doesnt show a client side available option for the inventory so we use jank callbacks to get this.
---<-- TODO swap to internal callback system
---This is used for the esx users, documentation doesnt show a client side available option for the inventory so we use jank callbacks to get this.
lib.callback.register('community_bridge:Callback:core_inventory', function(source)
local items = core:getItemsList()
return items or {}
+6 -7
View File
@@ -41,7 +41,6 @@ Inventory.GetItemInfo = function(item)
end
---Returns the specified slot data as a table.
---
---format {weight, name, metadata, slot, label, count}
---@param src number
---@param slot number
@@ -156,18 +155,18 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end
-- This will open the specified shop for the src passed.
---This will open the specified shop for the src passed.
---@param src number
---@param shopTitle string
Inventory.OpenShop = function(src, shopTitle)
jpr:OpenShop(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---This will register a shop, if it already exists it will return true.
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end
@@ -227,10 +227,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return true, print("Currently runtime shops are not supported in origen_inventory")
end
+4 -4
View File
@@ -190,10 +190,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = true
+4 -4
View File
@@ -185,10 +185,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end
+4 -4
View File
@@ -223,10 +223,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, print("Currently qs shop is not bridged")
end
@@ -213,10 +213,10 @@ Inventory.OpenShop = function(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
-- @param shopTitle string
-- @param shopInventory table
-- @param shopCoords table
-- @param shopGroups table
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, print("Currently tgiann-inventory is not bridged for shops")
end
+3 -2
View File
@@ -2,7 +2,8 @@ local resourceName = "ox_lib"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {}
--- Converts a QB menu to an Ox menu.
---Converts a QB menu to an Ox menu.
---@param id string The menu ID.
---@param menu table The QB menu data.
---@return table The Ox menu data.
@@ -50,4 +51,4 @@ OpenMenu = function(id, data, useQBinput)
lib.registerContext(data)
lib.showContext(id)
return data
end
end
+2 -2
View File
@@ -1,8 +1,8 @@
local resourceName = "qb-menu"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Loading QB Menu")
--- Converts an Ox menu to a QB menu.
---Converts an Ox menu to a QB menu.
---@param id string The menu ID.
---@param menu table The Ox menu data.
---@return table The QB menu data.
+5 -92
View File
@@ -1,7 +1,7 @@
Menus = Menus or {}
Menu = {}
--- Opens a menu based on the configuration.
---Opens a menu based on the configuration.
---@param data table The menu data.
---@param useQb boolean Whether to use QB menu syntax.
---@return id string The menu ID.
@@ -12,9 +12,9 @@ function Menu.Open(data, useQb)
return id
end
--- Event to handle callback from menu selection.
--- @param _args table The arguments passed to the callback.
--- @return nil
---Event to handle callback from menu selection.
---@param _args table The arguments passed to the callback.
---@return nil
RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
local id = _args.id
local onSelect = _args.onSelect
@@ -23,91 +23,4 @@ RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
onSelect(args)
end)
return Menu
--[[
--Unit Tests
local qbMenu = {
{
header = 'QBCore Test Menu',
icon = 'fas fa-code',
isMenuHeader = true, -- Set to true to make a nonclickable title
},
{
header = 'First Button',
txt = 'Open a secondary menu!',
icon = 'fas fa-code-pull-request',
-- disabled = false, -- optional, non-clickable and grey scale
-- hidden = true, -- optional, hides the button completely
params = {
-- isServer = false, -- optional, specify event type
event = 'community_bridge:client:TestEvent',
args = {
number = 1,
}
}
},
{
header = 'Second Button',
txt = 'Open a secondary menu!',
icon = 'fas fa-code-pull-request',
params = {
event = 'community_bridge:client:TestEvent',
args = {
number = 2,
}
}
}
}
local oxMenu = {
id = "test",
title = "Test Menu",
options = {
{
title = "First Button",
description = "Open a secondary menu!",
icon = "fas fa-code-pull-request",
args = {
number = 1,
},
onSelect = function(selected, secondary, args)
print("Selected", json.encode(selected))
end
},
{
title = "Second Button",
description = "Open a secondary menu!",
icon = "fas fa-code-pull-request",
args = {
number = 2,
},
onSelect = function(selected, secondary, args)
print("Selected", json.encode(selected))
end
}
}
}
RegisterCommand("testmenu-qbtoox", function()
Menu.Open(qbMenu, true)
end)
RegisterCommand("testmenu-oxtoqb", function()
Menu.Open(oxMenu, false)
end)
RegisterCommand("testmenu-oxtoox", function()
Menu.Open(oxMenu, false)
end)
RegisterCommand("testmenu-qbtoqb", function()
Menu.Open(qbMenu, true)
end)
RegisterNetEvent('community_bridge:client:TestEvent', function(args)
print("Test Event", json.encode(args))
end)
--]]
return Menu
+5 -2
View File
@@ -1,9 +1,13 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_lib"
local configValue = BridgeClientConfig.ProgressBarSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
ProgressBar = ProgressBar or {}
---This function converts a QB progress bar options table to an Ox progress bar options table.
---@param options table
---@return table
local function convertFromQB(options)
if not options then return options end
local prop1 = options.prop or {}
@@ -46,9 +50,8 @@ end
---This function opens a progress bar.
---@param options table
---@param cb any
---@param isQBInput boolean
---@param isQBInput boolean||optional
---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
function ProgressBar.Open(options, cb, isQBInput)
if isQBInput then
options = convertFromQB(options)
@@ -1,9 +1,13 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "progressbar"
local configValue = BridgeClientConfig.ProgressBarSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
ProgressBar = ProgressBar or {}
---This function converts an Ox progress bar options table to a QB progress bar options table.
---@param options table
---@return table
local function convertFromOx(options)
if not options then return options end
local prop1 = options.prop?[1] or options.prop or {}
@@ -34,7 +38,7 @@ local function convertFromOx(options)
propTwo = {
model = prop2.model,
bone = prop2.bone,
coords = prop2.pos,
coords = prop2.pos,
rotation = prop2.rot
}
}
@@ -45,7 +49,6 @@ end
---@param cb any
---@param qbFormat boolean
---@return boolean boolean
---@diagnostic disable-next-line: duplicate-set-field
function ProgressBar.Open(options, cb, qbFormat)
if not exports['progressbar'] then return false end
+1 -1
View File
@@ -2,7 +2,7 @@ Shops = Shops or {}
local registeredShops = {}
---commentThis can open a shop for the client
---This can open a shop for the client
---@param src number
---@param shopTitle string
---@return boolean
+9 -3
View File
@@ -1,17 +1,23 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local function warnUser()
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the name of the Skills system being being used.
---@return string
Skills.GetResourceName = function()
return "none"
end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the skill level of the passed skill name.
---@param skillName string
---@return number
---@return nil
Skills.GetSkillLevel = function(skillName)
return 0, warnUser()
warnUser()
return 0
end
return Skills
+23 -7
View File
@@ -1,27 +1,43 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local function warnUser()
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the name of the Skills system being being used.
---@return string
Skills.GetResourceName = function()
return "none"
end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the skill level of the passed skill name.
---@param src number
---@param skillName string
---@return number
Skills.GetSkillLevel = function(src, skillName)
return 0, warnUser()
warnUser()
return 0
end
---@diagnostic disable-next-line: duplicate-set-field
---This will add xp to the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.AddXp = function(src, skillName, amount)
return false, warnUser()
warnUser()
return false
end
---@diagnostic disable-next-line: duplicate-set-field
---This will remove xp from the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.RemoveXp = function(src, skillName, amount)
return false, warnUser()
warnUser()
return false
end
return Skills
+6 -2
View File
@@ -1,14 +1,18 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local resourceName = "evolent_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the name of the Skills system being used.
---@return string
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the skill level of the passed skill name.
---@param skillName string
---@return number
Skills.GetSkillLevel = function(skillName)
local skillData = exports.evolent_skills:getSkillLevel(skillName)
return skillData or 0
+18 -4
View File
@@ -1,20 +1,30 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local resourceName = "evolent_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the name of the Skills system being used.
---@return string
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the skill level of the passed skill name.
---@param src number
---@param skillName string
---@return number
Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
return skillData or 0
end
---@diagnostic disable-next-line: duplicate-set-field
---This will add xp to the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
@@ -22,7 +32,11 @@ Skills.AddXp = function(src, skillName, amount)
return true
end
---@diagnostic disable-next-line: duplicate-set-field
---This will remove xp from the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
+7 -2
View File
@@ -1,14 +1,19 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local resourceName = "OT_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the name of the Skills system being used.
---@return string
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the skill level of the passed skill name.
---@param skillName string
---@return number
Skills.GetSkillLevel = function(skillName)
local skillData = exports.OT_skills:getSkill(skillName)
return skillData.level or 0
+18 -2
View File
@@ -1,19 +1,30 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local resourceName = "OT_skills"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the name of the Skills system being used.
---@return string
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the skill level of the passed skill name.
---@param src number
---@param skillName string
---@return number
Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.OT_skills:getSkill(src, skillName)
return skillData.level or 0
end
---This will add xp to the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end
@@ -21,6 +32,11 @@ Skills.AddXp = function(src, skillName, amount)
return true
end
---This will remove xp from the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end
+7 -3
View File
@@ -1,16 +1,20 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local resourceName = "pickle_xp"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the name of the Skills system being used.
---@return string
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the skill level of the passed skill name.
---@param skillName string
---@return number
Skills.GetSkillLevel = function(skillName)
local skillData = exports.OT_skills:GetLevel(skillName)
local skillData = exports.pickle_xp:GetLevel(skillName)
return skillData or 0
end
+18 -2
View File
@@ -1,19 +1,30 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local resourceName = "pickle_xp"
local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---@diagnostic disable-next-line: duplicate-set-field
---This will get the name of the Skills system being used.
---@return string
Skills.GetResourceName = function()
return resourceName
end
---@diagnostic disable-next-line: duplicate-set-field
---This will return the skill level of the passed skill name.
---@param src number
---@param skillName string
---@return number
Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
return skillData or 0
end
---This will add xp to the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
@@ -21,6 +32,11 @@ Skills.AddXp = function(src, skillName, amount)
return true
end
---This will remove xp from the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Target = Target or {}
local function warnUser()
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_target"
if GetResourceState(resourceName) == 'missing' then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qb-target"
if GetResourceState(resourceName) == 'missing' then return end
if GetResourceState("ox_target") == 'started' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "sleepless_interact"
if GetResourceState(resourceName) == 'missing' then return end
if GetResourceState("ox_target") == 'started' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "F_RealCarKeysSystem"
if GetResourceState(resourceName) == 'missing' then return end
VehicleKey = VehicleKey or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "MrNewbVehicleKeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "Renewed-Vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
VehicleKey = VehicleKey or {}
---This will give keys to the specifed vehicle/plate.
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "cd_garage"
if GetResourceState(resourceName) == 'missing' then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "jaksams_VehiclesKeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "mk_vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end
VehicleKey = VehicleKey or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "mono_carkeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "okokGarage"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qb-vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qbx_vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qs-vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "t1ger_keys"
if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "wasabi_carlock"
if GetResourceState(resourceName) == 'missing' then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Weather = Weather or {}
---This will toggle the players weather/time sync
+3 -1
View File
@@ -1,8 +1,10 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('cd_easytime') == 'missing' then return end
Weather = Weather or {}
---comment
---This will toggle the players weather/time sync
---@param toggle boolean
---@return nil
Weather.ToggleSync = function(toggle)
TriggerEvent('cd_easytime:PauseSync', toggle)
end
@@ -1,8 +1,10 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-weathersync') == 'missing' then return end
Weather = Weather or {}
---comment
---This will toggle the players weather/time sync
---@param toggle boolean
---@return nil
Weather.ToggleSync = function(toggle)
if toggle then
TriggerEvent("qb-weathersync:client:EnableSync")
@@ -1,8 +1,10 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('Renewed-Weathersync') == 'missing' then return end
Weather = Weather or {}
---comment
---This will toggle the players weather/time sync
---@param toggle boolean
---@return nil
Weather.ToggleSync = function(toggle)
LocalPlayer.state.syncWeather = toggle
end