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
85 files changed
+247 -194

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end if GetResourceState('esx_skin') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
+5 -3
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end if GetResourceState('esx_skin') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
Clothing.Players = {} Clothing.Players = {}
@@ -49,7 +50,8 @@ function Clothing.GetAppearance(src, fullData)
return completeData.converted return completeData.converted
end end
---This will save the player's current appearance to the database
---@param src number|string
function Clothing.Save(src) function Clothing.Save(src)
src = src and tonumber(src) src = src and tonumber(src)
assert(src, "src is nil") assert(src, "src is nil")
@@ -134,7 +136,8 @@ function Clothing.Revert(src)
return Clothing.SetAppearance(src, backup) return Clothing.SetAppearance(src, backup)
end end
---This will open the menu for the passed src
---@param src number|string
function Clothing.OpenMenu(src) function Clothing.OpenMenu(src)
src = src and tonumber(src) src = src and tonumber(src)
assert(src, "src is nil") assert(src, "src is nil")
@@ -180,7 +183,6 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source)
return Clothing.GetAppearance(src) return Clothing.GetAppearance(src)
end) end)
RegisterCommand('clothing:debug', function(source, args, rawCommand) RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source local src = source
Clothing.SetAppearance(src, { Clothing.SetAppearance(src, {
+1 -1
View File
@@ -1,4 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end if GetResourceState('esx_skin') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
+1 -1
View File
@@ -1,4 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end if GetResourceState('fivem-appearance') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end if GetResourceState('fivem-appearance') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
Clothing.Players = {} Clothing.Players = {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end if GetResourceState('illenium-appearance') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end if GetResourceState('illenium-appearance') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
Clothing.Players = {} Clothing.Players = {}
+1 -2
View File
@@ -1,8 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end if GetResourceState('qb-clothing') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
function Clothing.OpenMenu() function Clothing.OpenMenu()
TriggerEvent('qb-clothing:client:openMenu') TriggerEvent('qb-clothing:client:openMenu')
end end
+3 -4
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end if GetResourceState('qb-clothing') == 'missing' then return end
Clothing = Clothing or {} Clothing = Clothing or {}
Clothing.Players = {} Clothing.Players = {}
@@ -145,8 +146,6 @@ AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
Clothing.Players[strSrc] = nil Clothing.Players[strSrc] = nil
end) end)
--- Event handler for when the resource starts --- Event handler for when the resource starts
--- Caches appearance data for all currently connected players --- Caches appearance data for all currently connected players
AddEventHandler('onResourceStart', function(resource) AddEventHandler('onResourceStart', function(resource)
@@ -166,7 +165,7 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source)
return Clothing.GetAppearance(src) return Clothing.GetAppearance(src)
end) end)
--[[
RegisterCommand('clothing:debug', function(source, args, rawCommand) RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source local src = source
Clothing.SetAppearance(src, { Clothing.SetAppearance(src, {
@@ -206,7 +205,7 @@ RegisterCommand('clothing:openmenu', function(source, args, rawCommand)
local src = source local src = source
Clothing.OpenMenu(src) Clothing.OpenMenu(src)
end, false) end, false)
--]]
-- RegisterCommand('clothing:crowley', function(source, args, rawCommand) -- RegisterCommand('clothing:crowley', function(source, args, rawCommand)
-- local src = source -- local src = source
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
---This will send an alert to currently supported dispatch systems. ---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 if GetResourceState('bub-mdt') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('cd_dispatch') == 'missing' then return end if GetResourceState('cd_dispatch') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
+2 -1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('lb-tablet') == 'missing' then return end if GetResourceState('lb-tablet') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -13,7 +14,7 @@ local function getPriorityLevel(priority)
end end
end end
---commentThis will send an alert to the passed jobs ---This will send an alert to the passed jobs
---@param data table ---@param data table
Dispatch.SendAlert = function(data) Dispatch.SendAlert = function(data)
local streetName, _ = Utility.GetStreetNameAtCoords(data.coords) local streetName, _ = Utility.GetStreetNameAtCoords(data.coords)
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('linden_outlawalert') == 'missing' then return end if GetResourceState('linden_outlawalert') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('ps-dispatch') == 'missing' then return end if GetResourceState('ps-dispatch') == 'missing' then return end
if GetResourceState('lb-tablet') == 'started' then return end if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qs-dispatch') == 'missing' then return end if GetResourceState('qs-dispatch') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('redutzu-mdt') == 'missing' then return end if GetResourceState('redutzu-mdt') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('tk_dispatch') == 'missing' then return end if GetResourceState('tk_dispatch') == 'missing' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will get the closest door to the ped ---This will get the closest door to the ped
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "BigDaddy-Fuel" local resourceName = "BigDaddy-Fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "cdn-fuel" local resourceName = "cdn-fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "esx-sna-fuel" local resourceName = "esx-sna-fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "LegacyFuel" local resourceName = "LegacyFuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "okokGasStation" local resourceName = "okokGasStation"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_fuel" local resourceName = "ox_fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ps-fuel" local resourceName = "ps-fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qs-fuelstations" local resourceName = "qs-fuelstations"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "Renewed-Fuel" local resourceName = "Renewed-Fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ti_fuel" local resourceName = "ti_fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "x-fuel" local resourceName = "x-fuel"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {} HelpText = HelpText or {}
---This will show a help text message at the screen position passed ---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 {} HelpText = HelpText or {}
---This will show a help text message to the specified player at the screen position passed ---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 {} HelpText = HelpText or {}
local resourceName = "cd_drawtextui" local resourceName = "cd_drawtextui"
local configValue = BridgeSharedConfig.HelpText local configValue = BridgeSharedConfig.HelpText
@@ -8,14 +9,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string ---@param message string
---@param _position string ---@param _position string
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position) HelpText.ShowHelpText = function(message, _position)
return TriggerEvent('cd_drawtextui:ShowUI', 'show', message) return TriggerEvent('cd_drawtextui:ShowUI', 'show', message)
end end
---This will hide the help text message on the screen ---This will hide the help text message on the screen
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function() HelpText.HideHelpText = function()
return TriggerEvent('cd_drawtextui:HideUI') return TriggerEvent('cd_drawtextui:HideUI')
end end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {} HelpText = HelpText or {}
local resourceName = "jg-textui" local resourceName = "jg-textui"
local configValue = BridgeSharedConfig.HelpText local configValue = BridgeSharedConfig.HelpText
@@ -7,14 +8,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string ---@param message string
---@param _position string ---@param _position string
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position) HelpText.ShowHelpText = function(message, _position)
return exports['jg-textui']:DrawText(message) return exports['jg-textui']:DrawText(message)
end end
---This will hide the help text message on the screen ---This will hide the help text message on the screen
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function() HelpText.HideHelpText = function()
return exports['jg-textui']:HideText() return exports['jg-textui']:HideText()
end end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {} HelpText = HelpText or {}
local resourceName = "lab-HintUI" local resourceName = "lab-HintUI"
local configValue = BridgeSharedConfig.HelpText local configValue = BridgeSharedConfig.HelpText
@@ -7,14 +8,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string ---@param message string
---@param _position string ---@param _position string
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position) HelpText.ShowHelpText = function(message, _position)
return exports['lab-HintUI']:Show(message, "Hint Text") return exports['lab-HintUI']:Show(message, "Hint Text")
end end
---This will hide the help text message on the screen ---This will hide the help text message on the screen
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function() HelpText.HideHelpText = function()
return exports['lab-HintUI']:Hide() return exports['lab-HintUI']:Hide()
end end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {} HelpText = HelpText or {}
local resourceName = "okokTextUI" local resourceName = "okokTextUI"
local configValue = BridgeSharedConfig.HelpText local configValue = BridgeSharedConfig.HelpText
@@ -7,14 +8,12 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string ---@param message string
---@param _position string ---@param _position string
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, _position) HelpText.ShowHelpText = function(message, _position)
return exports['okokTextUI']:Open(message, 'darkblue', _position, false) return exports['okokTextUI']:Open(message, 'darkblue', _position, false)
end end
---This will hide the help text message on the screen ---This will hide the help text message on the screen
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function() HelpText.HideHelpText = function()
return exports['okokTextUI']:Close() return exports['okokTextUI']:Close()
end end
+1 -2
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {} HelpText = HelpText or {}
local resourceName = "ox_lib" local resourceName = "ox_lib"
local configValue = BridgeSharedConfig.HelpText local configValue = BridgeSharedConfig.HelpText
@@ -7,7 +8,6 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@param message string ---@param message string
---@param position string ---@param position string
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.ShowHelpText = function(message, position) HelpText.ShowHelpText = function(message, position)
return exports.ox_lib:showTextUI(message, { return exports.ox_lib:showTextUI(message, {
position = position or 'top-center' position = position or 'top-center'
@@ -16,7 +16,6 @@ end
---This will hide the help text message on the screen ---This will hide the help text message on the screen
---@return nil ---@return nil
---@diagnostic disable-next-line: duplicate-set-field
HelpText.HideHelpText = function() HelpText.HideHelpText = function()
return exports.ox_lib:hideTextUI() return exports.ox_lib:hideTextUI()
end end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qb-input" local resourceName = "qb-input"
local configValue = BridgeClientConfig.InputSystem local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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 resourceName = "ox_lib"
local configValue = BridgeClientConfig.InputSystem local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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.") return false, Prints.Error("This Inventory Has Not Been Bridged For A Trunk Feature.")
end end
---This will clear the specified inventory, will return success or failure.
---@param id string
---@return boolean
Inventory.ClearStash = function(id, _type) Inventory.ClearStash = function(id, _type)
if type(id) ~= "string" then return false end if type(id) ~= "string" then return false end
return false, Prints.Error("This Inventory Has Not Been Bridged For A ClearStash Feature.") return false, Prints.Error("This Inventory Has Not Been Bridged For A ClearStash Feature.")
end 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 ---@param item string
---@return table ---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
@@ -47,8 +51,8 @@ Inventory.GetItemInfo = function(item)
end end
---This will return the count of the item in the players inventory, if not found will return 0. ---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. ---if metadata is passed it will find the matching items count.
---example: 0
---@param src number ---@param src number
---@param item string ---@param item string
---@param metadata table ---@param metadata table
@@ -58,6 +62,7 @@ Inventory.GetItemCount = function(src, item, metadata)
end end
---This wil return the players inventory. ---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 ---@param src number
---@return table ---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
@@ -65,8 +70,7 @@ Inventory.GetPlayerInventory = function(src)
end end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
--- ---example {weight = 10, name = "farts", metadata = {description = "this is a description"}, slot = 1, label = "stinky", count = 1}
---format {weight, name, metadata, slot, label, count}
---@param src number ---@param src number
---@param slot number ---@param slot number
---@return table ---@return table
@@ -152,10 +156,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, Prints.Error("This Inventory Has Not Been Bridged For A CreateShop Feature.") return false, Prints.Error("This Inventory Has Not Been Bridged For A CreateShop Feature.")
end end
@@ -167,6 +171,10 @@ Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135" return "https://avatars.githubusercontent.com/u/47620135"
end 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) Inventory.StripPNG = function(item)
if string.find(item, ".png") then if string.find(item, ".png") then
item = string.gsub(item, ".png", "") item = string.gsub(item, ".png", "")
+4 -4
View File
@@ -193,10 +193,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) 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.") 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 end
+8 -12
View File
@@ -52,7 +52,6 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
end end
---This will return the count of the item in the players inventory, if not found will return 0. ---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. ---if metadata is passed it will find the matching items count.
---@param src number ---@param src number
---@param item string ---@param item string
@@ -110,7 +109,6 @@ Inventory.GetPlayerInventory = function(src)
end end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
---
---format {weight, name, metadata, slot, label, count} ---format {weight, name, metadata, slot, label, count}
---@param src number ---@param src number
---@param slot number ---@param slot number
@@ -175,7 +173,6 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
groups = groups, groups = groups,
coords = coords coords = coords
} }
--core:openInventory(nil, id, 'stash', mathyShit, mathyShit, false, nil, false)
return true, id return true, id
end end
@@ -246,25 +243,24 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end 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 src number
---@param shopTitle string ---@param shopTitle string
Inventory.OpenShop = function(src, shopTitle) 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.") 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 end
-- This will register a shop, if it already exists it will return true. ---This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) 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.") 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 end
---<-- TODO swap to internal callback system
--<-- 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.
-- 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) lib.callback.register('community_bridge:Callback:core_inventory', function(source)
local items = core:getItemsList() local items = core:getItemsList()
return items or {} return items or {}
+6 -7
View File
@@ -41,7 +41,6 @@ Inventory.GetItemInfo = function(item)
end end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
---
---format {weight, name, metadata, slot, label, count} ---format {weight, name, metadata, slot, label, count}
---@param src number ---@param src number
---@param slot number ---@param slot number
@@ -156,18 +155,18 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end 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 src number
---@param shopTitle string ---@param shopTitle string
Inventory.OpenShop = function(src, shopTitle) Inventory.OpenShop = function(src, shopTitle)
jpr:OpenShop(src, shopTitle) jpr:OpenShop(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. ---This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end if registeredShops[shopTitle] then return true end
@@ -227,10 +227,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return true, print("Currently runtime shops are not supported in origen_inventory") return true, print("Currently runtime shops are not supported in origen_inventory")
end end
+4 -4
View File
@@ -190,10 +190,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if registeredShops[shopTitle] then return true end if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = true registeredShops[shopTitle] = true
+4 -4
View File
@@ -185,10 +185,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end if registeredShops[shopTitle] then return true end
+4 -4
View File
@@ -223,10 +223,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, print("Currently qs shop is not bridged") return false, print("Currently qs shop is not bridged")
end end
@@ -213,10 +213,10 @@ Inventory.OpenShop = function(src, shopTitle)
end end
-- This will register a shop, if it already exists it will return true. -- This will register a shop, if it already exists it will return true.
-- @param shopTitle string ---@param shopTitle string
-- @param shopInventory table ---@param shopInventory table
-- @param shopCoords table ---@param shopCoords table
-- @param shopGroups table ---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups) Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, print("Currently tgiann-inventory is not bridged for shops") return false, print("Currently tgiann-inventory is not bridged for shops")
end end
+1
View File
@@ -2,6 +2,7 @@ local resourceName = "ox_lib"
local configValue = BridgeClientConfig.MenuSystem local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {} 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 id string The menu ID.
---@param menu table The QB menu data. ---@param menu table The QB menu data.
+1 -1
View File
@@ -1,7 +1,7 @@
local resourceName = "qb-menu" local resourceName = "qb-menu"
local configValue = BridgeClientConfig.MenuSystem local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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 id string The menu ID.
---@param menu table The Ox menu data. ---@param menu table The Ox menu data.
-87
View File
@@ -24,90 +24,3 @@ RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
end) end)
return Menu 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)
--]]
+5 -2
View File
@@ -1,9 +1,13 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_lib" local resourceName = "ox_lib"
local configValue = BridgeClientConfig.ProgressBarSystem local configValue = BridgeClientConfig.ProgressBarSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
ProgressBar = ProgressBar or {} 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) local function convertFromQB(options)
if not options then return options end if not options then return options end
local prop1 = options.prop or {} local prop1 = options.prop or {}
@@ -46,9 +50,8 @@ end
---This function opens a progress bar. ---This function opens a progress bar.
---@param options table ---@param options table
---@param cb any ---@param cb any
---@param isQBInput boolean ---@param isQBInput boolean||optional
---@return boolean ---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
function ProgressBar.Open(options, cb, isQBInput) function ProgressBar.Open(options, cb, isQBInput)
if isQBInput then if isQBInput then
options = convertFromQB(options) options = convertFromQB(options)
@@ -1,9 +1,13 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "progressbar" local resourceName = "progressbar"
local configValue = BridgeClientConfig.ProgressBarSystem local configValue = BridgeClientConfig.ProgressBarSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
ProgressBar = ProgressBar or {} 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) local function convertFromOx(options)
if not options then return options end if not options then return options end
local prop1 = options.prop?[1] or options.prop or {} local prop1 = options.prop?[1] or options.prop or {}
@@ -45,7 +49,6 @@ end
---@param cb any ---@param cb any
---@param qbFormat boolean ---@param qbFormat boolean
---@return boolean boolean ---@return boolean boolean
---@diagnostic disable-next-line: duplicate-set-field
function ProgressBar.Open(options, cb, qbFormat) function ProgressBar.Open(options, cb, qbFormat)
if not exports['progressbar'] then return false end if not exports['progressbar'] then return false end
+1 -1
View File
@@ -2,7 +2,7 @@ Shops = Shops or {}
local registeredShops = {} local registeredShops = {}
---commentThis can open a shop for the client ---This can open a shop for the client
---@param src number ---@param src number
---@param shopTitle string ---@param shopTitle string
---@return boolean ---@return boolean
+9 -3
View File
@@ -1,17 +1,23 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {} Skills = Skills or {}
local function warnUser() 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.") 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 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() Skills.GetResourceName = function()
return "none" return "none"
end 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) Skills.GetSkillLevel = function(skillName)
return 0, warnUser() warnUser()
return 0
end end
return Skills return Skills
+23 -7
View File
@@ -1,27 +1,43 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {} Skills = Skills or {}
local function warnUser() 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.") 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 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() Skills.GetResourceName = function()
return "none" return "none"
end 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) Skills.GetSkillLevel = function(src, skillName)
return 0, warnUser() warnUser()
return 0
end 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) Skills.AddXp = function(src, skillName, amount)
return false, warnUser() warnUser()
return false
end 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) Skills.RemoveXp = function(src, skillName, amount)
return false, warnUser() warnUser()
return false
end end
return Skills return Skills
+6 -2
View File
@@ -1,14 +1,18 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {} Skills = Skills or {}
local resourceName = "evolent_skills" local resourceName = "evolent_skills"
local configValue = BridgeSharedConfig.Skills local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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() Skills.GetResourceName = function()
return resourceName return resourceName
end 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) Skills.GetSkillLevel = function(skillName)
local skillData = exports.evolent_skills:getSkillLevel(skillName) local skillData = exports.evolent_skills:getSkillLevel(skillName)
return skillData or 0 return skillData or 0
+18 -4
View File
@@ -1,20 +1,30 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {} Skills = Skills or {}
local resourceName = "evolent_skills" local resourceName = "evolent_skills"
local configValue = BridgeSharedConfig.Skills local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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() Skills.GetResourceName = function()
return resourceName return resourceName
end 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) Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName) local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
return skillData or 0 return skillData or 0
end 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) Skills.AddXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName) local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end if not skillData then return false, print("Skill not found") end
@@ -22,7 +32,11 @@ Skills.AddXp = function(src, skillName, amount)
return true return true
end 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) Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName) local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end 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 {} Skills = Skills or {}
local resourceName = "OT_skills" local resourceName = "OT_skills"
local configValue = BridgeSharedConfig.Skills local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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() Skills.GetResourceName = function()
return resourceName return resourceName
end 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) Skills.GetSkillLevel = function(skillName)
local skillData = exports.OT_skills:getSkill(skillName) local skillData = exports.OT_skills:getSkill(skillName)
return skillData.level or 0 return skillData.level or 0
+18 -2
View File
@@ -1,19 +1,30 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {} Skills = Skills or {}
local resourceName = "OT_skills" local resourceName = "OT_skills"
local configValue = BridgeSharedConfig.Skills local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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() Skills.GetResourceName = function()
return resourceName return resourceName
end 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) Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.OT_skills:getSkill(src, skillName) local skillData = exports.OT_skills:getSkill(src, skillName)
return skillData.level or 0 return skillData.level or 0
end 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) Skills.AddXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName) local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end if not skillData then return false, print("Skill not found") end
@@ -21,6 +32,11 @@ Skills.AddXp = function(src, skillName, amount)
return true return true
end 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) Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName) local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end 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 {} Skills = Skills or {}
local resourceName = "pickle_xp" local resourceName = "pickle_xp"
local configValue = BridgeSharedConfig.Skills local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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() Skills.GetResourceName = function()
return resourceName return resourceName
end 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) Skills.GetSkillLevel = function(skillName)
local skillData = exports.OT_skills:GetLevel(skillName) local skillData = exports.pickle_xp:GetLevel(skillName)
return skillData or 0 return skillData or 0
end end
+18 -2
View File
@@ -1,19 +1,30 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {} Skills = Skills or {}
local resourceName = "pickle_xp" local resourceName = "pickle_xp"
local configValue = BridgeSharedConfig.Skills local configValue = BridgeSharedConfig.Skills
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end 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() Skills.GetResourceName = function()
return resourceName return resourceName
end 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) Skills.GetSkillLevel = function(src, skillName)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName) local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
return skillData or 0 return skillData or 0
end 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) Skills.AddXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName) local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end if not skillData then return false, print("Skill not found") end
@@ -21,6 +32,11 @@ Skills.AddXp = function(src, skillName, amount)
return true return true
end 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) Skills.RemoveXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName) local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end 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 {} Target = Target or {}
local function warnUser() local function warnUser()
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "ox_target" local resourceName = "ox_target"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qb-target" local resourceName = "qb-target"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
if GetResourceState("ox_target") == 'started' then return end if GetResourceState("ox_target") == 'started' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "sleepless_interact" local resourceName = "sleepless_interact"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
if GetResourceState("ox_target") == 'started' then return end if GetResourceState("ox_target") == 'started' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "F_RealCarKeysSystem" local resourceName = "F_RealCarKeysSystem"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "MrNewbVehicleKeys" local resourceName = "MrNewbVehicleKeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "Renewed-Vehiclekeys" local resourceName = "Renewed-Vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
---This will give keys to the specifed vehicle/plate. ---This will give keys to the specifed vehicle/plate.
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "cd_garage" local resourceName = "cd_garage"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "jaksams_VehiclesKeys" local resourceName = "jaksams_VehiclesKeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "mk_vehiclekeys" local resourceName = "mk_vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "mono_carkeys" local resourceName = "mono_carkeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "okokGarage" local resourceName = "okokGarage"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qb-vehiclekeys" local resourceName = "qb-vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qbx_vehiclekeys" local resourceName = "qbx_vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "qs-vehiclekeys" local resourceName = "qs-vehiclekeys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "t1ger_keys" local resourceName = "t1ger_keys"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "wasabi_carlock" local resourceName = "wasabi_carlock"
if GetResourceState(resourceName) == 'missing' then return end if GetResourceState(resourceName) == 'missing' then return end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Weather = Weather or {} Weather = Weather or {}
---This will toggle the players weather/time sync ---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 if GetResourceState('cd_easytime') == 'missing' then return end
Weather = Weather or {} Weather = Weather or {}
---comment ---This will toggle the players weather/time sync
---@param toggle boolean ---@param toggle boolean
---@return nil
Weather.ToggleSync = function(toggle) Weather.ToggleSync = function(toggle)
TriggerEvent('cd_easytime:PauseSync', toggle) TriggerEvent('cd_easytime:PauseSync', toggle)
end end
@@ -1,8 +1,10 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-weathersync') == 'missing' then return end if GetResourceState('qb-weathersync') == 'missing' then return end
Weather = Weather or {} Weather = Weather or {}
---comment ---This will toggle the players weather/time sync
---@param toggle boolean ---@param toggle boolean
---@return nil
Weather.ToggleSync = function(toggle) Weather.ToggleSync = function(toggle)
if toggle then if toggle then
TriggerEvent("qb-weathersync:client:EnableSync") TriggerEvent("qb-weathersync:client:EnableSync")
@@ -1,8 +1,10 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('Renewed-Weathersync') == 'missing' then return end if GetResourceState('Renewed-Weathersync') == 'missing' then return end
Weather = Weather or {} Weather = Weather or {}
---comment ---This will toggle the players weather/time sync
---@param toggle boolean ---@param toggle boolean
---@return nil
Weather.ToggleSync = function(toggle) Weather.ToggleSync = function(toggle)
LocalPlayer.state.syncWeather = toggle LocalPlayer.state.syncWeather = toggle
end end